fix: strip query params from asset URLs before filesystem lookup
All checks were successful
Deploy to Production / test (push) Successful in 36s
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user