mirror of
https://github.com/nextcloud/recognize.git
synced 2025-07-22 01:10:03 +00:00
fix(Classifier): Do not get stuck when decryption fails
fixes #1302 Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:

committed by
backportbot[bot]
![backportbot[bot]](/assets/img/avatar_default.png)
parent
24b6161881
commit
8e52cc98f3
@ -15,6 +15,7 @@ use OCA\Recognize\Db\QueueFile;
|
||||
use OCA\Recognize\Service\QueueService;
|
||||
use OCP\AppFramework\Services\IAppConfig;
|
||||
use OCP\DB\Exception;
|
||||
use OCP\Encryption\Exceptions\GenericEncryptionException;
|
||||
use OCP\Files\File;
|
||||
use OCP\Files\InvalidPathException;
|
||||
use OCP\Files\IRootFolder;
|
||||
@ -137,6 +138,14 @@ abstract class Classifier {
|
||||
$this->logger->warning($e->getMessage(), ['exception' => $e]);
|
||||
}
|
||||
continue;
|
||||
} catch (GenericEncryptionException $e) {
|
||||
$this->logger->warning('Could not load encrypted file', ['exception' => $e]);
|
||||
try {
|
||||
$this->queue->removeFromQueue($model, $queueFile);
|
||||
} catch (Exception $e) {
|
||||
$this->logger->warning($e->getMessage(), ['exception' => $e]);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,6 +267,7 @@ abstract class Classifier {
|
||||
* @param \OCP\Files\Node $file
|
||||
* @return string Path to file to process
|
||||
* @throws \OCP\Files\NotFoundException
|
||||
* @throws GenericEncryptionException
|
||||
*/
|
||||
private function getConvertedFilePath(Node $file): string {
|
||||
if (!$file instanceof File) {
|
||||
@ -289,9 +299,9 @@ abstract class Classifier {
|
||||
if ($imageType > 0) {
|
||||
$this->logger->debug('generating preview of ' . $file->getId() . ' with dimension ' . self::TEMP_FILE_DIMENSION . ' using gdlib');
|
||||
return $this->generatePreviewWithGD($path);
|
||||
} else {
|
||||
return $path;
|
||||
}
|
||||
|
||||
return $path;
|
||||
} catch (\Throwable $e) {
|
||||
$this->logger->warning('Failed to generate preview of ' . $file->getId() . ' with dimension ' . self::TEMP_FILE_DIMENSION . ' with gdlib: ' . $e->getMessage());
|
||||
return $path;
|
||||
|
Reference in New Issue
Block a user