immich/server
Lin, Chiang-Yu b26b0cc806
fix(server): let a second metadata extraction replace stored AV metadata (#30900)
`upsertExif` writes derived audio, video and keyframe metadata with an
`ON CONFLICT DO UPDATE`, but every column in those three update lists
assigns the stored row back to itself:

    bitrate: ref('asset_audio.bitrate')

`SET bitrate = asset_audio.bitrate` is a self-assignment, so once a row
exists nothing can change it. Re-running metadata extraction re-reads the
file, builds a fresh snapshot, and then quietly discards it. The rest of the
file already uses `excluded` for this, as does `plugin.repository.ts`.

`asset_video.frameCount` had a second problem: it is supplied on insert but
was missing from the update list, so it would have stayed stale even after
the reference was corrected.

Extraction is meant to be repeatable. Probing improves between releases, a
file can be repaired or replaced, and a fix to how a stream is chosen is
worthless if it cannot reach the assets that were already imported. An
`upsert` that silently degrades to insert-only defeats all of that.

Metadata extraction is the only caller that passes these three objects, and
it passes a complete snapshot or nothing: each object is built from a single
probe behind a guard, and `upsertExif` skips the branch entirely when the
object is absent. So taking the incoming row cannot write partial values
over good ones. The other three callers pass `exif` only, and every other
reference to these tables is a read.
2026-08-22 17:58:05 +00:00
..
bin fix(server): memory fragmentation (#27027) 2026-03-26 18:21:52 +01:00
src fix(server): let a second metadata extraction replace stored AV metadata (#30900) 2026-08-22 17:58:05 +00:00
test fix(server): let a second metadata extraction replace stored AV metadata (#30900) 2026-08-22 17:58:05 +00:00
.gitignore
.npmignore chore: use pnpm for builds (#19752) 2025-08-19 08:55:24 -04:00
.prettierignore
.prettierrc
Dockerfile fix(ci): docker caching (#30894) 2026-08-20 16:37:43 -04:00
Dockerfile.dev chore(deps): update ghcr.io/jdx/mise docker tag to v2026.8.8 (#30834) 2026-08-18 13:08:52 +02:00
eslint.config.mjs chore: single line block comments (#30852) 2026-08-18 17:55:26 +02:00
helmet.json fix(server): updated default CSP config to support videos from V3 player (#29830) 2026-07-15 12:49:18 +02:00
mise.toml refactor: plugin sdk types (#28674) 2026-05-28 22:04:15 +00:00
nest-cli.json fix: isolate docker host/container filesystem for node_modules and build output (#21167) 2025-08-24 13:09:45 -05:00
package.json fix(deps): update sharp to ^0.35.3 (#29132) 2026-08-19 15:49:10 -04:00
tsconfig.build.json chore: move .tsbuildinfo file to dist folder (#27682) 2026-04-10 16:02:25 +02:00
tsconfig.json chore(deps): update dependency eslint-plugin-unicorn to v70 - abandoned (#29684) 2026-07-20 23:47:14 -04:00