Skip to content
Snippets Groups Projects
Commit 0a6b851b authored by Paul Kaplan's avatar Paul Kaplan
Browse files

Fix backpack crashing the GUI when trying to store a cloud variable

Converting string to b64 via window.btoa fails on characters outside codepoints 0-255, include the "cloud" in cloud variable names
parent a5aea97f
No related branches found
No related tags found
No related merge requests found
......@@ -64,6 +64,7 @@
"immutable": "3.8.2",
"intl": "1.2.5",
"jest": "^21.0.0",
"js-base64": "2.4.9",
"keymirror": "0.1.1",
"lodash.bindall": "4.4.0",
"lodash.debounce": "4.0.8",
......
import blockToImage from './block-to-image';
import jpegThumbnail from './jpeg-thumbnail';
import {Base64} from 'js-base64';
const codePayload = ({blockObjects, topBlockId}) => {
const payload = {
type: 'script', // Needs to match backpack-server type name
name: 'code', // All code currently gets the same name
mime: 'application/json',
body: btoa(JSON.stringify(blockObjects)) // Base64 encode the json
// Backpack expects a base64 encoded string to store. Cannot use btoa because
// the code can contain characters outside the 0-255 code-point range supported by btoa
body: Base64.encode(JSON.stringify(blockObjects)) // Base64 encode the json
};
return blockToImage(topBlockId)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment