Fix issue with site loading on older versions of Safari (#10077)

This commit is contained in:
DS Boyce
2026-03-19 15:50:25 -07:00
committed by GitHub
parent 876e20166a
commit 3e7d7ce5f4
+4 -2
View File
@@ -36,12 +36,14 @@ export type ImgproxyPreset =
| 'feed_thumbnail'
| 'download'
// Using capturing groups here instead of lookbehinds in order to support older versions of Safari.
// https://bugs.webkit.org/show_bug.cgi?id=174931
const IMGPROXY_PRESET_RE =
/(?<=\/img\/)(default|avatar_thumbnail|avatar|banner|feed_fullsize|feed_thumbnail|download)(?=\/)/
/(\/img\/)(default|avatar_thumbnail|avatar|banner|feed_fullsize|feed_thumbnail|download)(\/)/
/**
* Replaces any imgproxy preset in a CDN URI with the given preset.
*/
export function convertCdnPreset(uri: string, preset: ImgproxyPreset): string {
return uri.replace(IMGPROXY_PRESET_RE, preset)
return uri.replace(IMGPROXY_PRESET_RE, `$1${preset}$3`)
}