Skip to content

Commit

Permalink
fix(storage): md5 calculation for react native
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashwin Kumar committed Sep 20, 2024
1 parent 28434a6 commit 10e6dc4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions packages/storage/src/providers/s3/utils/md5.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ export const calculateContentMd5 = async (
content: Blob | string | ArrayBuffer | ArrayBufferView,
): Promise<string> => {
const hasher = new Md5();
if (typeof content === 'string') {
if (
typeof content === 'string' ||
ArrayBuffer.isView(content) ||
content instanceof ArrayBuffer
) {
hasher.update(content);
} else if (ArrayBuffer.isView(content) || content instanceof ArrayBuffer) {
const blob = new Blob([content]);
const buffer = await readFile(blob);
hasher.update(buffer);
} else {
const buffer = await readFile(content);
hasher.update(buffer);
Expand Down
10 changes: 5 additions & 5 deletions packages/storage/src/providers/s3/utils/md5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ export const calculateContentMd5 = async (
content: Blob | string | ArrayBuffer | ArrayBufferView,
): Promise<string> => {
const hasher = new Md5();
if (typeof content === 'string') {
if (
typeof content === 'string' ||
ArrayBuffer.isView(content) ||
content instanceof ArrayBuffer
) {
hasher.update(content);
} else if (ArrayBuffer.isView(content) || content instanceof ArrayBuffer) {
const blob = new Blob([content]);
const buffer = await readFile(blob);
hasher.update(buffer);
} else {
const buffer = await readFile(content);
hasher.update(buffer);
Expand Down

0 comments on commit 10e6dc4

Please sign in to comment.