Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: bump e2e test runner to React Native 0.74.1 #7985

Merged
merged 20 commits into from
Sep 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: more stable method of uploading bytes
  • Loading branch information
russellwheatley committed Aug 29, 2024
commit 4ddbe1594722ef945787e629e5ea9daebd8d9ec2
20 changes: 8 additions & 12 deletions packages/storage/lib/web/RNFBStorageModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,28 +341,24 @@ export default {
putString(appName, url, string, format, metadata = {}, taskId) {
return guard(async () => {
const ref = getReferenceFromUrl(appName, url);
let decodedString = null;

let base64String = null;

// This is always either base64 or base64url
switch (format) {
case 'base64':
base64String = Base64.atob(string);
decodedString = Base64.atob(string);
break;
case 'base64url':
base64String = Base64.atob(string.replace(/_/g, '/').replace(/-/g, '+'));
decodedString = Base64.atob(string.replace(/_/g, '/').replace(/-/g, '+'));
break;
}

const byteArray = [];
const encoder = new TextEncoder();

if (base64String) {
for (var i = 0; i < base64String.length; ++i) {
byteArray.push(base64String.charCodeAt(i));
}
}
const arrayBuffer = encoder.encode(decodedString).buffer;

// Start a resumable upload task.
const task = uploadBytesResumable(ref, byteArray, {
// Start a resumable upload task using the Uint8Array directly.
const task = uploadBytesResumable(ref, arrayBuffer, {
...makeSettableMetadata(metadata),
md5Hash: metadata.md5Hash,
});
Expand Down
Loading