Skip to content

Commit e395304

Browse files
committed
fix: Throw exception in PreviewManager when preview is not available
Signed-off-by: Akhil <akhil@e.email>
1 parent cac44fd commit e395304

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/private/PreviewManager.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function getPreview(
154154
$mimeType = null,
155155
bool $cacheResult = true,
156156
): ISimpleFile {
157-
$this->throwIfPreviewsDisabled();
157+
$this->throwIfPreviewsDisabled($file);
158158
$previewConcurrency = $this->getGenerator()->getNumConcurrentPreviews('preview_concurrency_all');
159159
$sem = Generator::guardWithSemaphore(Generator::SEMAPHORE_ID_ALL, $previewConcurrency);
160160
try {
@@ -178,7 +178,7 @@ public function getPreview(
178178
* @since 19.0.0
179179
*/
180180
public function generatePreviews(File $file, array $specifications, $mimeType = null) {
181-
$this->throwIfPreviewsDisabled();
181+
$this->throwIfPreviewsDisabled($file);
182182
return $this->getGenerator()->generatePreviews($file, $specifications, $mimeType);
183183
}
184184

@@ -455,8 +455,8 @@ private function registerBootstrapProviders(): void {
455455
/**
456456
* @throws NotFoundException if preview generation is disabled
457457
*/
458-
private function throwIfPreviewsDisabled(): void {
459-
if (!$this->enablePreviews) {
458+
private function throwIfPreviewsDisabled(File $file): void {
459+
if (!$this->isAvailable($file)) {
460460
throw new NotFoundException('Previews disabled');
461461
}
462462
}

0 commit comments

Comments
 (0)