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

fix(react-storage): enable default checksum algorithm for create folder action #6305

Merged
merged 3 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions .changeset/large-swans-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@aws-amplify/ui-react-storage': patch
---

fix(react-storage): enable default checksum algorithm for create folder action #6305

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createFolderHandler, CreateFolderHandlerInput } from '../createFolder';

import { uploadData, UploadDataInput } from '../../../storage-internal';
import { DEFAULT_CHECKSUM_ALGORITHM } from '../constants';

jest.mock('../../../storage-internal');

Expand Down Expand Up @@ -70,6 +71,7 @@ describe('createFolderHandler', () => {
locationCredentialsProvider: credentials,
onProgress: expect.any(Function),
preventOverwrite: true,
checksumAlgorithm: DEFAULT_CHECKSUM_ALGORITHM,
},
path: baseInput.data.key,
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const DEFAULT_CHECKSUM_ALGORITHM = 'crc-32';
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
TaskHandlerOptions,
} from './types';
import { constructBucket, getProgress } from './utils';
import { DEFAULT_CHECKSUM_ALGORITHM } from './constants';

export interface CreateFolderHandlerData extends TaskData {
preventOverwrite?: boolean;
Expand Down Expand Up @@ -48,6 +49,7 @@ export const createFolderHandler: CreateFolderHandler = (input) => {
if (isFunction(onProgress)) onProgress(data, getProgress(event));
},
preventOverwrite,
checksumAlgorithm: DEFAULT_CHECKSUM_ALGORITHM,
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from './types';

import { constructBucket, getProgress } from './utils';
import { DEFAULT_CHECKSUM_ALGORITHM } from './constants';

export interface UploadHandlerOptions
extends TaskHandlerOptions<{ key: string }> {}
Expand All @@ -34,8 +35,6 @@ export interface UploadHandler
// https://github.com/aws-amplify/amplify-js/blob/1a5366d113c9af4ce994168653df3aadb142c581/packages/storage/src/providers/s3/utils/constants.ts#L16
export const MULTIPART_UPLOAD_THRESHOLD_BYTES = 5 * 1024 * 1024;

export const DEFAULT_CHECKSUM_ALGORITHM = 'crc-32';

export const UNDEFINED_CALLBACKS = {
cancel: undefined,
pause: undefined,
Expand Down
Loading