diff options
author | Stephan Orbaugh <62374139+sorbaugh@users.noreply.github.com> | 2025-05-20 13:32:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-20 13:32:45 +0200 |
commit | edf21d9242f7342de7ae3ba1354727b7ccbc6eae (patch) | |
tree | c5d884ab56a8c323a31c23a948962fc96d919d87 | |
parent | 565d524cd4b95e24469f9d0c105cd72dddbdd757 (diff) | |
parent | e537500c8e0b100a5fb7fdae26ee58f5e24a8d14 (diff) | |
download | nextcloud-server-edf21d9242f7342de7ae3ba1354727b7ccbc6eae.tar.gz nextcloud-server-edf21d9242f7342de7ae3ba1354727b7ccbc6eae.zip |
Merge pull request #52859 from Murena-SAS/dev/external-storage-previews
fix: Throw exception in PreviewManager when preview is not available
-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'); } } |