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-11-23 15:31:52 +0300
committerJulien Veyssier <eneiluj@posteo.net>2022-01-03 12:27:36 +0300
commitf3b1559f7e428312a4df87ab84009bb06c835080 (patch)
treee021099d6cd46ada765f31201e2507eabaef2fb6 /lib
parent4e074e7be5fd88c7c13396d480b2e60961e5d852 (diff)
psalm issues
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/ImageController.php2
-rw-r--r--lib/Service/ImageService.php19
2 files changed, 3 insertions, 18 deletions
diff --git a/lib/Controller/ImageController.php b/lib/Controller/ImageController.php
index 5e8e587b0..b530cd733 100644
--- a/lib/Controller/ImageController.php
+++ b/lib/Controller/ImageController.php
@@ -213,7 +213,6 @@ class ImageController extends Controller {
* @throws \OCP\Files\NotFoundException
* @throws \OCP\Files\NotPermittedException
* @throws \OCP\Lock\LockedException
- * @throws \OC\User\NoUserException
*/
public function getImage(int $textFileId, string $imageFileName): DataDisplayResponse {
$imageFile = $this->imageService->getImage($textFileId, $imageFileName, $this->userId);
@@ -237,7 +236,6 @@ class ImageController extends Controller {
* @throws \OCP\Files\NotFoundException
* @throws \OCP\Files\NotPermittedException
* @throws \OCP\Lock\LockedException
- * @throws \OC\User\NoUserException
*/
public function getImagePublic(int $textFileId, string $imageFileName, string $shareToken): DataDisplayResponse {
$imageFile = $this->imageService->getImagePublic($textFileId, $imageFileName, $shareToken);
diff --git a/lib/Service/ImageService.php b/lib/Service/ImageService.php
index 7e402c700..3ba5de931 100644
--- a/lib/Service/ImageService.php
+++ b/lib/Service/ImageService.php
@@ -92,11 +92,10 @@ class ImageService {
* @throws NotFoundException
* @throws \OCP\Files\InvalidPathException
* @throws \OCP\Files\NotPermittedException
- * @throws \OC\User\NoUserException
*/
public function getImage(int $textFileId, string $imageFileName, string $userId) {
$textFile = $this->getTextFile($textFileId, $userId);
- return $this->getImagePreview($imageFileName, $textFile);
+ return $textFile === null ? $textFile : $this->getImagePreview($imageFileName, $textFile);
}
/**
@@ -108,11 +107,10 @@ class ImageService {
* @throws NotFoundException
* @throws \OCP\Files\InvalidPathException
* @throws \OCP\Files\NotPermittedException
- * @throws \OC\User\NoUserException
*/
public function getImagePublic(int $textFileId, string $imageFileName, string $shareToken) {
$textFile = $this->getTextFilePublic($textFileId, $shareToken);
- return $this->getImagePreview($imageFileName, $textFile);
+ return $textFile === null ? $textFile : $this->getImagePreview($imageFileName, $textFile);
}
/**
@@ -122,7 +120,6 @@ class ImageService {
* @throws NotFoundException
* @throws \OCP\Files\InvalidPathException
* @throws \OCP\Files\NotPermittedException
- * @throws \OC\User\NoUserException
*/
private function getImagePreview(string $imageFileName, File $textFile) {
$attachmentFolder = $this->getOrCreateAttachmentDirectoryForFile($textFile);
@@ -154,7 +151,6 @@ class ImageService {
* @throws NotFoundException
* @throws \OCP\Files\InvalidPathException
* @throws \OCP\Files\NotPermittedException
- * @throws \OC\User\NoUserException
*/
public function uploadImage(int $textFileId, string $newFileName, string $newFileContent, string $userId): array {
$textFile = $this->getTextFile($textFileId, $userId);
@@ -187,7 +183,6 @@ class ImageService {
* @throws NotFoundException
* @throws \OCP\Files\InvalidPathException
* @throws \OCP\Files\NotPermittedException
- * @throws \OC\User\NoUserException
*/
public function uploadImagePublic(?int $textFileId, string $newFileName, string $newFileContent, string $shareToken): array {
if (!$this->hasUpdatePermissions($shareToken)) {
@@ -221,7 +216,6 @@ class ImageService {
* @throws \OCP\Files\InvalidPathException
* @throws \OCP\Files\NotPermittedException
* @throws \OCP\Lock\LockedException
- * @throws \OC\User\NoUserException
*/
public function insertImageFile(int $textFileId, string $path, string $userId): array {
$textFile = $this->getTextFile($textFileId, $userId);
@@ -275,7 +269,6 @@ class ImageService {
* @throws NotFoundException
* @throws \OCP\Files\InvalidPathException
* @throws \OCP\Files\NotPermittedException
- * @throws \OC\User\NoUserException
*/
public function insertImageLink(int $textFileId, string $link, string $userId): array {
$textFile = $this->getTextFile($textFileId, $userId);
@@ -395,7 +388,6 @@ class ImageService {
* @return Folder|null
* @throws NotFoundException
* @throws \OCP\Files\NotPermittedException
- * @throws \OC\User\NoUserException
*/
private function getOrCreateTextDirectory(string $userId): ?Folder {
$userFolder = $this->rootFolder->getUserFolder($userId);
@@ -419,7 +411,6 @@ class ImageService {
* @throws NotFoundException
* @throws \OCP\Files\InvalidPathException
* @throws \OCP\Files\NotPermittedException
- * @throws \OC\User\NoUserException
*/
private function getOrCreateAttachmentDirectoryForFile(File $textFile): ?Folder {
$owner = $textFile->getOwner();
@@ -449,7 +440,6 @@ class ImageService {
* @return File|null
* @throws NotFoundException
* @throws \OCP\Files\NotPermittedException
- * @throws \OC\User\NoUserException
*/
private function getFileFromPath(string $filePath, string $userId): ?File {
$userFolder = $this->rootFolder->getUserFolder($userId);
@@ -467,11 +457,8 @@ class ImageService {
*
* @param int $textFileId
* @param string $userId
- * @return Folder|null
- * @throws \OCP\Files\InvalidPathException
- * @throws \OCP\Files\NotFoundException
+ * @return File|null
* @throws \OCP\Files\NotPermittedException
- * @throws \OC\User\NoUserException
*/
private function getTextFile(int $textFileId, string $userId): ?File {
$userFolder = $this->rootFolder->getUserFolder($userId);