File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
__tests__/providers/s3/apis/uploadData
src/providers/s3/apis/uploadData Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -180,6 +180,22 @@ describe('uploadData with path', () => {
180
180
} ,
181
181
) ;
182
182
183
+ it ( 'should use putObject for 0 bytes data (e.g. create a folder)' , ( ) => {
184
+ const testInput = {
185
+ path : 'test-path' ,
186
+ data : '' , // 0 bytes
187
+ } ;
188
+
189
+ uploadData ( testInput ) ;
190
+
191
+ expect ( mockPutObjectJob ) . toHaveBeenCalledWith (
192
+ testInput ,
193
+ expect . any ( AbortSignal ) ,
194
+ expect . any ( Number ) ,
195
+ ) ;
196
+ expect ( mockGetMultipartUploadHandlers ) . not . toHaveBeenCalled ( ) ;
197
+ } ) ;
198
+
183
199
it ( 'should use uploadTask' , async ( ) => {
184
200
mockPutObjectJob . mockReturnValueOnce ( 'putObjectJob' ) ;
185
201
mockCreateUploadTask . mockReturnValueOnce ( 'uploadTask' ) ;
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ export function uploadData(input: UploadDataInput | UploadDataWithPathInput) {
135
135
StorageValidationErrorCode . ObjectIsTooLarge ,
136
136
) ;
137
137
138
- if ( dataByteLength && dataByteLength <= DEFAULT_PART_SIZE ) {
138
+ if ( dataByteLength !== undefined && dataByteLength <= DEFAULT_PART_SIZE ) {
139
139
// Single part upload
140
140
const abortController = new AbortController ( ) ;
141
141
You can’t perform that action at this time.
0 commit comments