fix: only multipart when count is greater than 1

This commit is contained in:
Prateek Sunal 2024-04-07 12:09:59 +05:30
parent 2a4a551d52
commit 12c1aa4c28

View file

@ -497,13 +497,16 @@ class FileUploader {
await encryptedFile.length(), await encryptedFile.length(),
); );
final fileUploadURLs = await getMultipartUploadURLs(count); String fileObjectKey;
final fileObjectKey = fileUploadURLs.objectKey;
await putMultipartFile(fileUploadURLs, encryptedFile); if (count <= 1) {
final fileUploadURL = await _getUploadURL();
fileObjectKey = await _putFile(fileUploadURL, encryptedFile);
} else {
final fileUploadURLs = await getMultipartUploadURLs(count);
fileObjectKey = await putMultipartFile(fileUploadURLs, encryptedFile);
}
// final fileUploadURL = await _getUploadURL();
// fileObjectKey = await _putFile(fileUploadURL, encryptedFile);
final metadata = await file.getMetadataForUpload(mediaUploadData); final metadata = await file.getMetadataForUpload(mediaUploadData);
final encryptedMetadataResult = await CryptoUtil.encryptChaCha( final encryptedMetadataResult = await CryptoUtil.encryptChaCha(
utf8.encode(jsonEncode(metadata)) as Uint8List, utf8.encode(jsonEncode(metadata)) as Uint8List,