mirror of
https://github.com/nextcloud/recognize.git
synced 2025-08-15 22:56:19 +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:
@ -15,6 +15,7 @@ use OCA\Recognize\Db\QueueFile;
|
|||||||
use OCA\Recognize\Service\QueueService;
|
use OCA\Recognize\Service\QueueService;
|
||||||
use OCP\AppFramework\Services\IAppConfig;
|
use OCP\AppFramework\Services\IAppConfig;
|
||||||
use OCP\DB\Exception;
|
use OCP\DB\Exception;
|
||||||
|
use OCP\Encryption\Exceptions\GenericEncryptionException;
|
||||||
use OCP\Files\File;
|
use OCP\Files\File;
|
||||||
use OCP\Files\InvalidPathException;
|
use OCP\Files\InvalidPathException;
|
||||||
use OCP\Files\IRootFolder;
|
use OCP\Files\IRootFolder;
|
||||||
@ -140,6 +141,14 @@ abstract class Classifier {
|
|||||||
$this->logger->warning($e->getMessage(), ['exception' => $e]);
|
$this->logger->warning($e->getMessage(), ['exception' => $e]);
|
||||||
}
|
}
|
||||||
continue;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,6 +270,7 @@ abstract class Classifier {
|
|||||||
* @param \OCP\Files\Node $file
|
* @param \OCP\Files\Node $file
|
||||||
* @return string Path to file to process
|
* @return string Path to file to process
|
||||||
* @throws \OCP\Files\NotFoundException
|
* @throws \OCP\Files\NotFoundException
|
||||||
|
* @throws GenericEncryptionException
|
||||||
*/
|
*/
|
||||||
private function getConvertedFilePath(Node $file): string {
|
private function getConvertedFilePath(Node $file): string {
|
||||||
if (!$file instanceof File) {
|
if (!$file instanceof File) {
|
||||||
@ -292,9 +302,9 @@ abstract class Classifier {
|
|||||||
if ($imageType > 0) {
|
if ($imageType > 0) {
|
||||||
$this->logger->debug('generating preview of ' . $file->getId() . ' with dimension ' . self::TEMP_FILE_DIMENSION . ' using gdlib');
|
$this->logger->debug('generating preview of ' . $file->getId() . ' with dimension ' . self::TEMP_FILE_DIMENSION . ' using gdlib');
|
||||||
return $this->generatePreviewWithGD($path);
|
return $this->generatePreviewWithGD($path);
|
||||||
} else {
|
|
||||||
return $path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $path;
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$this->logger->warning('Failed to generate preview of ' . $file->getId() . ' with dimension ' . self::TEMP_FILE_DIMENSION . ' with gdlib: ' . $e->getMessage());
|
$this->logger->warning('Failed to generate preview of ' . $file->getId() . ' with dimension ' . self::TEMP_FILE_DIMENSION . ' with gdlib: ' . $e->getMessage());
|
||||||
return $path;
|
return $path;
|
||||||
|
Reference in New Issue
Block a user