[mob] Rethrow exception due to content size

This commit is contained in:
Neeraj Gupta
2024-09-05 09:28:27 +05:30
committed by Neeraj Gupta
parent 4999e9d944
commit 5820d03bb5

View File

@@ -1297,16 +1297,8 @@ class FileUploader {
return uploadURL.objectKey;
} on DioError catch (e) {
if (e.message.startsWith(
"HttpException: Content size exceeds specified contentLength.",
) &&
attempt == 1) {
return _putFile(
uploadURL,
file,
contentLength: (await file.readAsBytes()).length,
attempt: 2,
);
if (e.message.startsWith("HttpException: Content size")) {
rethrow;
} else if (attempt < kMaximumUploadAttempts) {
final newUploadURL = await _getUploadURL();
return _putFile(