Skip to content

Commit

Permalink
fix: Throw if file has no owner
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Jul 24, 2023
1 parent 146aa5f commit e2e8358
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/Service/AttachmentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,9 @@ private function hasUpdatePermissions(string $shareToken): bool {
*/
private function getAttachmentDirectoryForFile(File $textFile, bool $create = false): Folder {
$owner = $textFile->getOwner();
if ($owner === null) {
throw new NotFoundException('File has no owner');
}
$ownerId = $owner->getUID();
$ownerUserFolder = $this->rootFolder->getUserFolder($ownerId);
$ownerTextFile = $ownerUserFolder->getById($textFile->getId());
Expand Down
2 changes: 1 addition & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<psalm
errorLevel="4"
errorLevel="3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand Down

0 comments on commit e2e8358

Please sign in to comment.