Selaa lähdekoodia

[server] Fix another validation issue (#1514)

## Description

## Tests
Tested file create and file update locally
Neeraj Gupta 1 vuosi sitten
vanhempi
commit
ba2ca95c5b
1 muutettua tiedostoa jossa 4 lisäystä ja 3 poistoa
  1. 4 3
      server/pkg/controller/file.go

+ 4 - 3
server/pkg/controller/file.go

@@ -90,10 +90,11 @@ func (c *FileController) validateFileCreateOrUpdateReq(userID int64, file ente.F
 		if collection.IsDeleted {
 			return stacktrace.Propagate(ente.ErrNotFound, "collection has been deleted")
 		}
+		if file.OwnerID != userID {
+			return stacktrace.Propagate(ente.ErrPermissionDenied, "file ownerID doesn't match with userID")
+		}
 	}
-	if file.OwnerID != userID {
-		return stacktrace.Propagate(ente.ErrPermissionDenied, "file ownerID doesn't match with userID")
-	}
+
 	return nil
 }