Skip to content

Commit aeee692

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into fix/installation-guide-update
2 parents 6a6eeb2 + d32cb71 commit aeee692

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

client/i18n.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ const options = {
3737
allowMultiLoading: false, // set loadPath: '/locales/resources.json?lng={{lng}}&ns={{ns}}' to adapt to multiLoading
3838
};
3939

40-
console.log('options', options);
41-
4240
i18n
4341
.use(initReactI18next) // pass the i18n instance to react-i18next.
4442
// .use(LanguageDetector)// to detect the language from currentBrowser

client/modules/IDE/actions/uploader.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ function localIntercept(file, options = {}) {
3131
});
3232
}
3333

34+
function toBinary(string) {
35+
const codeUnits = new Uint16Array(string.length);
36+
for (let i = 0; i < codeUnits.length; i += 1) {
37+
codeUnits[i] = string.charCodeAt(i);
38+
}
39+
return String.fromCharCode(...new Uint8Array(codeUnits.buffer));
40+
}
41+
3442
export function dropzoneAcceptCallback(userId, file, done) {
3543
return () => {
3644
// if a user would want to edit this file as text, local interceptor
@@ -93,9 +101,12 @@ export function dropzoneCompleteCallback(file) {
93101
url: `${s3BucketHttps}${file.postData.key}`,
94102
originalFilename: file.name
95103
};
96-
// console.log(json, JSON.stringify(json), JSON.stringify(json).replace('"', '\\"'));
97-
inputHidden += `${window.btoa(JSON.stringify(json))}" />`;
98-
// document.getElementById('uploader').appendChild(inputHidden);
104+
105+
let jsonStr = JSON.stringify(json);
106+
107+
// convert the json string to binary data so that btoa can encode it
108+
jsonStr = toBinary(jsonStr);
109+
inputHidden += `${window.btoa(jsonStr)}" />`;
99110
document.getElementById('uploader').innerHTML += inputHidden;
100111

101112
const formParams = {

0 commit comments

Comments
 (0)