immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
45.05k stars 2.18k forks source link

Metadata extraction does not tolerate bad "Rating" field in EXIF #12476

Open bo0tzz opened 1 week ago

bo0tzz commented 1 week ago

Introduced in #11580. @stumpigit if you're willing to PR a fix that would be much appreciated (but no pressure).

The value probably just needs validate() called on it, and ideally a test is written to cover this case as well.

Related: #2229

[Nest] 7  - 09/08/2024, 9:43:37 AM VERBOSE [Microservices:MetadataService] Exif Tags
[Nest] 7  - 09/08/2024, 9:43:37 AM VERBOSE [Microservices:MetadataService] Object:
{
  (snip)
  "Rating": "Entity= Criteria= ",
  (...)
}

[Nest] 7  - 09/08/2024, 9:43:37 AM   ERROR [Microservices:JobService] Unable to run job handler (metadataExtraction/metadata-extraction): QueryFailedError: invalid input syntax for type integer: "Entity= Criteria= "
[Nest] 7  - 09/08/2024, 9:43:37 AM   ERROR [Microservices:JobService] QueryFailedError: invalid input syntax for type integer: "Entity= Criteria= "
    at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async InsertQueryBuilder.execute (/usr/src/app/node_modules/typeorm/query-builder/InsertQueryBuilder.js:106:33)
    at async AssetRepository.upsertExif (/usr/src/app/dist/repositories/asset.repository.js:49:9)
    at async MetadataService.handleMetadataExtraction (/usr/src/app/dist/services/metadata.service.js:201:9)
    at async /usr/src/app/dist/services/job.service.js:148:36
    at async Worker.processJob (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:394:28)
    at async Worker.retryIfFailed (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:581:24)
stumpigit commented 1 week ago

Thanks for the hint. I will be happy to look into this over the next few days.