Merge pull request #52983 from nextcloud/backport/52859/stable30

This commit is contained in:
Kate 2025-05-20 14:25:08 +02:00 committed by GitHub
commit 00a940bd74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -151,7 +151,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 {
@ -175,7 +175,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);
}
@ -452,8 +452,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');
}
}