diff --git a/lib/utils/file_util.dart b/lib/utils/file_util.dart index 97a6c779a..b1aa4fec3 100644 --- a/lib/utils/file_util.dart +++ b/lib/utils/file_util.dart @@ -177,8 +177,8 @@ Future _downloadAndDecrypt(File file, BaseCacheManager cacheManager, await CryptoUtil.decryptFile( encryptedFilePath, decryptedFilePath, - await decryptFileKey(file), - Sodium.base642bin(file.fileDecryptionHeader)); + Sodium.base642bin(file.fileDecryptionHeader), + await decryptFileKey(file)); logger.info("File decrypted: " + file.uploadedFileID.toString()); io.File(encryptedFilePath).deleteSync(); final fileExtension = extension(file.title).substring(1).toLowerCase(); @@ -192,6 +192,8 @@ Future _downloadAndDecrypt(File file, BaseCacheManager cacheManager, decryptedFile.deleteSync(); downloadsInProgress.remove(file.uploadedFileID); return cachedFile; + }).catchError((e) { + downloadsInProgress.remove(file.uploadedFileID); }); }