fix: clear error when navigating to cached image info and pass RAW extension

Error from a failed image (e.g. DNG) persisted when navigating to a
previously cached image because the cache path skipped setError(null).
Also pass the original file extension to decodeToSharpCompat so RAW
variants get the correct temp file suffix for ExifTool/ImageMagick.
This commit is contained in:
SnapOtter
2026-05-12 21:02:35 +08:00
parent 449f5dc97e
commit 7a3ec93847
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -44,8 +44,9 @@ export function registerInfo(app: FastifyInstance) {
// Decode CLI formats and HEIC before reading metadata
let metaBuffer = fileBuffer;
const ext = filename.split(".").pop()?.toLowerCase();
if (detectedFormat && needsCliDecode(detectedFormat)) {
metaBuffer = await decodeToSharpCompat(fileBuffer, detectedFormat);
metaBuffer = await decodeToSharpCompat(fileBuffer, detectedFormat, ext);
} else {
metaBuffer = await ensureSharpCompat(fileBuffer);
}
@@ -45,6 +45,7 @@ export function InfoSettings() {
const cached = cacheRef.current.get(index);
if (cached) {
setError(null);
setInfo(cached);
return;
}