Skip to content

Commit

Permalink
checking download attribute to download (Fix #687)
Browse files Browse the repository at this point in the history
  • Loading branch information
Antipkin-A committed Sep 9, 2022
1 parent 540eff4 commit 2fac82e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions controller/editorcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,17 @@ public function download($fileId, $toExtension = null, $template = false) {
}
}

$fileStorage = $file->getStorage();
if ($fileStorage->instanceOfStorage("\OCA\Files_Sharing\SharedStorage")) {
if (method_exists(IShare::class, "getAttributes")) {
$share = empty($share) ? $fileStorage->getShare() : $share;
$attributes = $share->getAttributes();
if ($attributes !== null && !$attributes->getAttribute("permissions", "download")) {
return $this->renderError($this->trans->t("Not permitted"));
}
}
}

$fileName = $file->getName();
$ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
$toExtension = strtolower($toExtension);
Expand Down

0 comments on commit 2fac82e

Please sign in to comment.