Improve assertion checks for move ops
This commit is contained in:
parent
e89d32355f
commit
4ce6c8592e
1 changed files with 10 additions and 0 deletions
|
@ -1443,9 +1443,19 @@ class CollectionsService {
|
|||
int fromCollectionID,
|
||||
List<EnteFile> files,
|
||||
) {
|
||||
final int userID = Configuration.instance.getUserID()!;
|
||||
if (toCollectionID == fromCollectionID) {
|
||||
throw AssertionError("Can't move to same album");
|
||||
}
|
||||
final Collection? toCollection = _collectionIDToCollections[toCollectionID];
|
||||
final Collection? fromCollection =
|
||||
_collectionIDToCollections[fromCollectionID];
|
||||
if (toCollection != null && !toCollection.isOwner(userID)) {
|
||||
throw AssertionError("Can't move to a collection you don't own");
|
||||
}
|
||||
if (fromCollection != null && !fromCollection.isOwner(userID)) {
|
||||
throw AssertionError("Can't move from a collection you don't own");
|
||||
}
|
||||
for (final file in files) {
|
||||
if (file.uploadedFileID == null) {
|
||||
throw AssertionError("Can only move uploaded memories");
|
||||
|
|
Loading…
Add table
Reference in a new issue