Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJulien Veyssier <eneiluj@posteo.net>2021-12-28 13:27:36 +0300
committerJulien Veyssier <eneiluj@posteo.net>2022-01-03 12:27:38 +0300
commitb4b4f1d38b0440e55a690d1caacceeab2b95a94f (patch)
treed47855c38e48b360484d663c502032a3cf0dc583 /lib
parented2f474d53e858f61edcf37f227768a25a40762d (diff)
fix stuff after PR comments
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/Service/ImageService.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Service/ImageService.php b/lib/Service/ImageService.php
index bba8ca5e6..db691a95f 100644
--- a/lib/Service/ImageService.php
+++ b/lib/Service/ImageService.php
@@ -32,6 +32,7 @@ use OCP\Constants;
use OCP\Files\Folder;
use OCP\Files\File;
use OCP\Files\NotFoundException;
+use OCP\Files\NotPermittedException;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\IPreview;
use OCP\Share\Exceptions\ShareNotFound;
@@ -153,7 +154,7 @@ class ImageService {
public function uploadImage(int $documentId, string $newFileName, string $newFileContent, string $userId): array {
$textFile = $this->getTextFile($documentId, $userId);
if (!$textFile->isUpdateable()) {
- throw new Exception('No write permissions');
+ throw new NotPermittedException('No write permissions');
}
$saveDir = $this->getOrCreateAttachmentDirectoryForFile($textFile);
if ($saveDir !== null) {
@@ -184,7 +185,7 @@ class ImageService {
*/
public function uploadImagePublic(?int $documentId, string $newFileName, string $newFileContent, string $shareToken): array {
if (!$this->hasUpdatePermissions($shareToken)) {
- throw new Exception('No write permissions');
+ throw new NotPermittedException('No write permissions');
}
$textFile = $this->getTextFilePublic($documentId, $shareToken);
$saveDir = $this->getOrCreateAttachmentDirectoryForFile($textFile);
@@ -218,7 +219,7 @@ class ImageService {
public function insertImageFile(int $documentId, string $path, string $userId): array {
$textFile = $this->getTextFile($documentId, $userId);
if (!$textFile->isUpdateable()) {
- throw new Exception('No write permissions');
+ throw new NotPermittedException('No write permissions');
}
$imageFile = $this->getFileFromPath($path, $userId);
$saveDir = $this->getOrCreateAttachmentDirectoryForFile($textFile);
@@ -271,7 +272,7 @@ class ImageService {
public function insertImageLink(int $documentId, string $link, string $userId): array {
$textFile = $this->getTextFile($documentId, $userId);
if (!$textFile->isUpdateable()) {
- throw new Exception('No write permissions');
+ throw new NotPermittedException('No write permissions');
}
$saveDir = $this->getOrCreateAttachmentDirectoryForFile($textFile);
if ($saveDir !== null) {
@@ -294,7 +295,7 @@ class ImageService {
*/
public function insertImageLinkPublic(?int $documentId, string $link, string $shareToken): array {
if (!$this->hasUpdatePermissions($shareToken)) {
- throw new Exception('No write permissions');
+ throw new NotPermittedException('No write permissions');
}
$textFile = $this->getTextFilePublic($documentId, $shareToken);
$saveDir = $this->getOrCreateAttachmentDirectoryForFile($textFile);