Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
code,
history,
match: { url }
} = this.props
try {
mermaid.parse(code)
// Replacing special characters '<' and '>' with encoded '<' and '>'
let _code = code
_code = _code.replace(//g, '>')
// Overriding the innerHTML with the updated code string
this.container.innerHTML = _code
mermaid.init(undefined, this.container)
} catch (e) {
// {str, hash}
const base64 = Base64.encodeURI(e.str || e.message)
history.push(`${url}/error/${base64}`)
}
}
_makeCodeVerifier() {
// minimum raw length 32
// see: https://tools.ietf.org/html/rfc7636#section-4.1
return Base64.encodeURI(cryptoGenerateRandom(32));
}
// Base64url Encoding without Padding
export const mermaidUrl = (graphStr, options, api) => {
const obj = {
code: graphStr,
mermaid: options
};
const objStr = JSON.stringify(obj);
let url = 'http://localhost:9000/e2e.html?graph=' + Base64.encodeURI(objStr);
if (api) {
url = 'http://localhost:9000/xss.html?graph=' + graphStr;
}
if (options.listUrl) {
cy.log(options.listId, ' ', url);
}
return url;
};
export const updateCodeStore = newState => {
codeStore.set(newState);
push('/edit/' + Base64.encodeURI(JSON.stringify(newState)))
};
const keys = Object.keys(longOptions);
const keysLength = keys.length;
let url = src + "?";
for (let i = 0; i < keysLength; i++) {
let key = keys[i];
let val = longOptions[key];
if (PARAM_EXPANSION[key]) {
key = PARAM_EXPANSION[key];
} else {
key = encodeURIComponent(key);
}
if (key.substr(-2) === "64") {
val = Base64.encodeURI(val);
}
url += key + "=" + encodeURIComponent(val) + "&";
}
return url.slice(0, -1);
}
getOAuthState = () => {
const credentialToken = random(43);
return Base64.encodeURI(JSON.stringify({ loginStyle: 'popup', credentialToken, isCordova: true }));
}
static createAccessTokenKey(clientId, userId, scope) {
return Base64.encodeURI(clientId) +
TOKEN_CACHE_KEY_DELIMITER +
Base64.encodeURI(normalizeId(userId)) +
TOKEN_CACHE_KEY_DELIMITER +
Base64.encodeURI(scope.toString())
}
export const linkToNodeModule = (name: string) => `/dashboard/nodemodule/${Base64.encodeURI(name)}`;
export const linkToModule = (identifier: string) =>
`/dashboard/ownmodule/${Base64.encodeURI(identifier)}`;
while (queue.length > 0) {
const { node, depth } = queue.pop()!;
if (depth > maxDepth) {
needsFiltering = true;
break;
}
if (--limit === 0) {
needsFiltering = true;
break;
}
const sourceEncoded = Base64.encodeURI(node.name);
for (const found of getReasonsFn(node)) {
const foundEncoded = Base64.encodeURI(found.name);
if (!sources.has(found.name)) {
sources.add(found.name);
queue.push({ node: found, depth: depth + 1 });
}
edges.push({
data: {
id: `edge${sourceEncoded}to${foundEncoded}`,
source: sourceEncoded,
target: foundEncoded,
},
});
}
nodes.push({