[mob]Discard upload to deleted or others collection

This commit is contained in:
Neeraj Gupta
2024-04-22 11:23:04 +05:30
parent 24d3156a5b
commit 206ab1114e
2 changed files with 27 additions and 0 deletions

View File

@@ -401,6 +401,16 @@ class FileUploader {
_logger.severe('Trying to upload file with missing localID');
return file;
}
if (!CollectionsService.instance.allowUpload(collectionID)) {
_logger.warning(
'Upload not allowed for collection $collectionID',
);
if (!file.isUploaded && file.generatedID != null) {
_logger.info("Deleting file entry for " + file.toString());
await FilesDB.instance.deleteByGeneratedID(file.generatedID!);
}
return file;
}
final String lockKey = file.localID!;