|
15 | 15 | use OCA\Recognize\Service\QueueService; |
16 | 16 | use OCP\AppFramework\Services\IAppConfig; |
17 | 17 | use OCP\DB\Exception; |
| 18 | +use OCP\Encryption\Exceptions\GenericEncryptionException; |
18 | 19 | use OCP\Files\File; |
19 | 20 | use OCP\Files\InvalidPathException; |
20 | 21 | use OCP\Files\IRootFolder; |
@@ -140,6 +141,14 @@ public function classifyFiles(string $model, array $queueFiles, int $timeout): \ |
140 | 141 | $this->logger->warning($e->getMessage(), ['exception' => $e]); |
141 | 142 | } |
142 | 143 | continue; |
| 144 | + } catch (GenericEncryptionException $e) { |
| 145 | + $this->logger->warning('Could not load encrypted file', ['exception' => $e]); |
| 146 | + try { |
| 147 | + $this->queue->removeFromQueue($model, $queueFile); |
| 148 | + } catch (Exception $e) { |
| 149 | + $this->logger->warning($e->getMessage(), ['exception' => $e]); |
| 150 | + } |
| 151 | + continue; |
143 | 152 | } |
144 | 153 | } |
145 | 154 |
|
@@ -261,6 +270,7 @@ public function classifyFiles(string $model, array $queueFiles, int $timeout): \ |
261 | 270 | * @param \OCP\Files\Node $file |
262 | 271 | * @return string Path to file to process |
263 | 272 | * @throws \OCP\Files\NotFoundException |
| 273 | + * @throws GenericEncryptionException |
264 | 274 | */ |
265 | 275 | private function getConvertedFilePath(Node $file): string { |
266 | 276 | if (!$file instanceof File) { |
@@ -292,9 +302,9 @@ private function getConvertedFilePath(Node $file): string { |
292 | 302 | if ($imageType > 0) { |
293 | 303 | $this->logger->debug('generating preview of ' . $file->getId() . ' with dimension ' . self::TEMP_FILE_DIMENSION . ' using gdlib'); |
294 | 304 | return $this->generatePreviewWithGD($path); |
295 | | - } else { |
296 | | - return $path; |
297 | 305 | } |
| 306 | + |
| 307 | + return $path; |
298 | 308 | } catch (\Throwable $e) { |
299 | 309 | $this->logger->warning('Failed to generate preview of ' . $file->getId() . ' with dimension ' . self::TEMP_FILE_DIMENSION . ' with gdlib: ' . $e->getMessage()); |
300 | 310 | return $path; |
|
0 commit comments