fix: strip query params from asset URLs before filesystem lookup
All checks were successful
Deploy to Production / test (push) Successful in 36s

Icon URLs stored with cache-busting query params (e.g. ?v=123) caused
existsSync to fail, preventing Discord attachment fallback and leaving
unresolvable localhost URLs as thumbnails.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
syntaxbullet
2026-03-26 15:48:19 +01:00
parent 58d07a02fd
commit 782a138fd8
3 changed files with 13 additions and 7 deletions

View File

@@ -18,5 +18,11 @@ export function getRarityConfig(rarity: string): { color: number; emoji: string;
}
export function defaultName(path: string): string {
return path.split("/").pop() || "image.png";
return stripQuery(path).split("/").pop() || "image.png";
}
/** Strip query parameters from a URL/path (e.g. "foo.png?v=123" → "foo.png") */
export function stripQuery(url: string): string {
const idx = url.indexOf("?");
return idx === -1 ? url : url.slice(0, idx);
}