diff --git a/mobile/lib/utils/file_uploader.dart b/mobile/lib/utils/file_uploader.dart index e55fe7d801..84c33446d1 100644 --- a/mobile/lib/utils/file_uploader.dart +++ b/mobile/lib/utils/file_uploader.dart @@ -820,6 +820,9 @@ class FileUploader { // file upload can be be retried in such cases without user intervention uploadHardFailure = false; } + if (isMultipartUpload && isPutOrUpdateFileError(e)) { + await UploadLocksDB.instance.deleteMultipartTrack(lockKey); + } rethrow; } finally { await _onUploadDone( @@ -835,6 +838,14 @@ class FileUploader { } } + bool isPutOrUpdateFileError(Object e) { + if (e is DioError) { + return e.requestOptions.path.contains("/files") || + e.requestOptions.path.contains("/files/update"); + } + return false; + } + /* _mapToExistingUpload links the fileToUpload with the existing uploaded files. if the link is successful, it returns true otherwise false.