Fix convertTextToBase64 for large files Reference: https://github.com/google/closure-library/blob/b312823ec5f84239ff1db7526f4a75cba0420a33/closure/goog/crypt/crypt.js#L104-L123

a029a6e1f1a1f72e9cb5547572ab9ad4ddb593e7

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +5 -1Showing whitespace changes
public/scripts/utils.js+5 -1
@@ -1469,7 +1469,11 @@ export function convertTextToBase64(text) {
1469 return utf8Bytes.toBase64();1469 return utf8Bytes.toBase64();
1470 }1470 }
1471 // Creates binary string, where each character's code point directly matches the byte value (0-255).1471 // Creates binary string, where each character's code point directly matches the byte value (0-255).
1472 const binaryString = String.fromCharCode(...utf8Bytes);1472 let binaryString = '';
1473 const chunkSize = 8192;
1474 for (let i = 0; i < utf8Bytes.length; i += chunkSize) {
1475 binaryString += String.fromCharCode(...utf8Bytes.subarray(i, i + chunkSize));
1476 }
1473 return window.btoa(binaryString);1477 return window.btoa(binaryString);
1474}1478}
14751479