fix(imaging): normalise avatar figures before building URLs
CI / check (push) Successful in 39s
CI / tests-integration (push) Successful in 2m2s
CI / tests-unit (push) Successful in 2m7s
CI / tests-ui (push) Successful in 2m46s
CI / preflight (push) Skipped
CI / tests-imaging-browsers (push) Successful in 3m9s
CI / tests-quality (push) Successful in 1m24s
CI / deploy (push) Successful in 4m9s

Legacy accounts can carry a malformed stored look — the old register default
`hr-100-.hd-180-1...` has an empty colour slot — which the imager rejects with
400 "Invalid figure format", so the avatar renders broken everywhere the look
appears. Normalise the figure in the shared URL builder (`getAvatarUrl`, used by
every avatar on the site): an unrenderable look becomes `DEFAULT_AVATAR_FIGURE`
while the proxy route keeps rejecting malformed input with 400.

The rule set and default now live in one client-safe module
(`src/lib/avatar-figure.ts`), shared by the URL builder and the server parser.
This commit is contained in:
openhands committed 2026-10-15 18:00:05 +02:00
1 parent 1e3406a7ae
commit 61107848f8
7 files changed
+106 -14

No files matched your search

+2 -1
View File
@@ -7,6 +7,7 @@
export type { AvatarOptions } from "@/types/admin";
import type { SyntheticEvent } from "react";
import { normalizeAvatarFigure } from "@/lib/avatar-figure";
import type { AvatarOptions } from "@/types/admin";
/**
@@ -46,7 +47,7 @@ export function getAvatarUrl(
} = options;
const params = new URLSearchParams({
figure,
figure: normalizeAvatarFigure(figure),
img_format,
effect: String(effect),
});