@@ -154,7 +154,7 @@ public function getPreview(
154154		$ mimeTypenull ,
155155		bool  $ cacheResulttrue ,
156156	): ISimpleFile 
157- 		$ this throwIfPreviewsDisabled ($ file
157+ 		$ this throwIfPreviewsDisabled ($ file,  $ mimeType 
158158		$ previewConcurrency$ this getGenerator ()->getNumConcurrentPreviews ('preview_concurrency_all ' );
159159		$ semguardWithSemaphore (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 $ filearray  $ specifications$ mimeTypenull ) {
181- 		$ this throwIfPreviewsDisabled ($ file
181+ 		$ this throwIfPreviewsDisabled ($ file,  $ mimeType 
182182		return  $ this getGenerator ()->generatePreviews ($ file$ specifications$ mimeType
183183	}
184184
@@ -213,13 +213,15 @@ public function isMimeSupported($mimeType = '*') {
213213	/** 
214214	 * Check if a preview can be generated for a file 
215215	 */ 
216- 	public  function  isAvailable (\OCP \Files \FileInfo   $ filebool  {
216+ 	public  function  isAvailable (\OCP \Files \FileInfo   $ file, ? string   $ mimeType  =  null ): bool  {
217217		if  (!$ this enablePreviews ) {
218218			return  false ;
219219		}
220220
221+ 		$ fileMimeType$ mimeType$ filegetMimeType ();
222+ 
221223		$ this registerCoreProviders ();
222- 		if  (!$ this isMimeSupported ($ file -> getMimetype () )) {
224+ 		if  (!$ this isMimeSupported ($ fileMimeType 
223225			return  false ;
224226		}
225227
@@ -229,7 +231,7 @@ public function isAvailable(\OCP\Files\FileInfo $file): bool {
229231		}
230232
231233		foreach  ($ this providers  as  $ supportedMimeType$ providers
232- 			if  (preg_match ($ supportedMimeType$ file -> getMimetype () )) {
234+ 			if  (preg_match ($ supportedMimeType$ fileMimeType 
233235				foreach  ($ providersas  $ providerClosure
234236					$ provider$ this helper ->getProvider ($ providerClosure
235237					if  (!($ providerinstanceof  IProviderV2)) {
@@ -455,8 +457,8 @@ private function registerBootstrapProviders(): void {
455457	/** 
456458	 * @throws NotFoundException if preview generation is disabled 
457459	 */ 
458- 	private  function  throwIfPreviewsDisabled (File $ filevoid  {
459- 		if  (!$ this isAvailable ($ file
460+ 	private  function  throwIfPreviewsDisabled (File $ file, ? string   $ mimeType  =  null ): void  {
461+ 		if  (!$ this isAvailable ($ file,  $ mimeType 
460462			throw  new  NotFoundException ('Previews disabled ' );
461463		}
462464	}
0 commit comments