mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
Merge pull request #52859 from Murena-SAS/dev/external-storage-previews
fix: Throw exception in PreviewManager when preview is not available
This commit is contained in:
commit
edf21d9242
1 changed files with 4 additions and 4 deletions
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue