fix: prevent double query string in GIF draft hydration

When loading a GIF from a draft, the URL was being corrupted with
double query strings like:
`?ww=498&hh=498?hh=498&ww=498`

This happened because:
1. serializeGif() adds ?ww=X&hh=Y&alt=Z to the Tenor URL
2. parseGifFromUrl() returned the full URL including our params
3. resolveGif() in resolve.ts then appends MORE params via string
   concatenation, creating a second ?

Fix: Strip our custom params (ww, hh, alt) from the URL in
parseGifFromUrl() before returning it, so the reconstructed GIF
has a clean base URL.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-01-16 13:23:21 +02:00
parent f396bac685
commit e5b700a3d2
+7 -1
View File
@@ -321,7 +321,13 @@ function parseGifFromUrl(
return undefined
}
return {url: uri, width, height, alt}
// Strip our custom params to get clean base URL
// This prevents double query strings when resolveGif() adds params again
url.searchParams.delete('ww')
url.searchParams.delete('hh')
url.searchParams.delete('alt')
return {url: url.toString(), width, height, alt}
} catch {
return undefined
}