fix(url): use URI-safe base64 encoding in URLs
This commit is contained in:
+2
-2
@@ -35,5 +35,5 @@ export const fromUrl = data => {
|
||||
};
|
||||
export const updateCodeStore = newState => {
|
||||
codeStore.set(newState);
|
||||
push('/edit/' + Base64.encode(JSON.stringify(newState)))
|
||||
};
|
||||
push('/edit/' + Base64.encodeURI(JSON.stringify(newState)))
|
||||
};
|
||||
|
||||
@@ -38,7 +38,7 @@ const handleConfUpdate = conf => {
|
||||
console.log('Error in parsed', e);
|
||||
configErrorStore.set(e);
|
||||
const str = JSON.stringify({ code, mermaid: oldConf });
|
||||
push('/edit/' + Base64.encode(str))
|
||||
push('/edit/' + Base64.encodeURI(str))
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ const handleCodeUpdate = code => {
|
||||
codeErrorStore.set(e);
|
||||
console.log('Error in parsed', e.hash);
|
||||
const str = JSON.stringify({ code: code, mermaid: conf });
|
||||
push('/edit/' + Base64.encode(str))
|
||||
push('/edit/' + Base64.encodeURI(str))
|
||||
const l = e.hash.line;
|
||||
decArr.push(edit.deltaDecorations([], [
|
||||
{ range: new monaco.Range(e.hash.loc.first_line,e.hash.loc.last_line,e.hash.loc.first_column,e.hash.loc.last_column), options: { inlineClassName: 'myInlineDecoration' }}]
|
||||
|
||||
@@ -53,8 +53,8 @@ export const onDownloadSVG = event => {
|
||||
let url = '/mermaid-live-editor/#/view';
|
||||
let iUrl;
|
||||
const unsubscribe = codeStore.subscribe( state => {
|
||||
url = '/mermaid-live-editor/#/view/' + Base64.encode(JSON.stringify(state));
|
||||
iUrl = `https://mermaid.ink/img/${Base64.encode(JSON.stringify(state))}`;
|
||||
url = '/mermaid-live-editor/#/view/' + Base64.encodeURI(JSON.stringify(state));
|
||||
iUrl = `https://mermaid.ink/img/${Base64.encodeURI(JSON.stringify(state))}`;
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -69,4 +69,4 @@ const unsubscribe = codeStore.subscribe( state => {
|
||||
<a href="{url}" download='' on:click={onDownloadPNG}>
|
||||
Download PNG
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user