fix(storage): thumb_derived_import claims JPEG sidecars too
The filter was strip_suffix(".webp"), but persist_rendered writes
{hash}.{format.ext()} — so any client not advertising WebP leaves
{hash}.jpg on disk. Correct only while the derived tier was WebP-only;
once variant carried the format (20261022000000) a JPEG sidecar became
ordinary content, and leaving it unclaimed would keep .thumbnails/
permanently non-empty — the very signal step 10e gates on. The migration
could never finish.
Both codecs are now claimed and the format comes from the file's own
extension, so a .jpg imports AS JPEG. Deriving the variant and
content_type from it rather than hardcoding WebP is the point: a
mislabelled row would serve the wrong codec to whoever the read path
then matched it for.
ThumbnailFormat::ALL exists so the claim list and the write path cannot
drift — adding a format without teaching the import about it would
strand that codec silently.
The `ext-` rejection now carries real weight. Previously .jpg was
rejected wholesale, so the two jobs could not overlap by construction;
now they share an extension and only the prefix separates them. Both
directions stay under test.
Caught by the cross-job assertion, which counts every real sidecar being
claimed exactly once — the fixture gained a .jpg and the total moved 3
to 4, which is the test noticing rather than a test to update.
This commit is contained in:
@@ -386,10 +386,13 @@ mod tests {
|
||||
);
|
||||
}
|
||||
// And nothing real is dropped: README.txt is the only unclaimed file.
|
||||
// Two content-keyed .webp, one content-keyed .jpg, one ext- upload.
|
||||
// The .jpg pair is the interesting one: same extension, opposite
|
||||
// keying, and only the `ext-` prefix separates them.
|
||||
assert_eq!(
|
||||
attached.len() + derived.len(),
|
||||
3,
|
||||
"the three real sidecars must be claimed exactly once between them"
|
||||
4,
|
||||
"every real sidecar must be claimed exactly once between the two jobs"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user