diff options
author | Akhil <akhil@e.email> | 2025-05-20 13:12:34 +0530 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2025-05-20 11:33:05 +0000 |
commit | 10af1be4d8713b59057aba6164c11d624a0a43a2 (patch) | |
tree | a4c04a767db90181cbd27ef30feb57602c5b7847 | |
parent | 8c5707e866547d2634bbef3cdbd3309d4b5f2bd0 (diff) | |
download | nextcloud-server-backport/52859/stable31.tar.gz nextcloud-server-backport/52859/stable31.zip |
fix: Throw exception in PreviewManager when preview is not availablebackport/52859/stable31
Signed-off-by: Akhil <akhil@e.email>
-rw-r--r-- | lib/private/PreviewManager.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php index 1f618dab22d..fa62a7b0257 100644 --- a/lib/private/PreviewManager.php +++ b/lib/private/PreviewManager.php @@ -154,7 +154,7 @@ class PreviewManager implements IPreview { $mimeType = null, bool $cacheResult = true, ): ISimpleFile { - $this->throwIfPreviewsDisabled(); + $this->throwIfPreviewsDisabled($file); $previewConcurrency = $this->getGenerator()->getNumConcurrentPreviews('preview_concurrency_all'); $sem = Generator::guardWithSemaphore(Generator::SEMAPHORE_ID_ALL, $previewConcurrency); try { @@ -178,7 +178,7 @@ class PreviewManager implements IPreview { * @since 19.0.0 */ public function generatePreviews(File $file, array $specifications, $mimeType = null) { - $this->throwIfPreviewsDisabled(); + $this->throwIfPreviewsDisabled($file); return $this->getGenerator()->generatePreviews($file, $specifications, $mimeType); } @@ -455,8 +455,8 @@ class PreviewManager implements IPreview { /** * @throws NotFoundException if preview generation is disabled */ - private function throwIfPreviewsDisabled(): void { - if (!$this->enablePreviews) { + private function throwIfPreviewsDisabled(File $file): void { + if (!$this->isAvailable($file)) { throw new NotFoundException('Previews disabled'); } } |