···3636 | 'feed_thumbnail'
3737 | 'download'
38383939+// Using capturing groups here instead of lookbehinds in order to support older versions of Safari.
4040+// https://bugs.webkit.org/show_bug.cgi?id=174931
3941const IMGPROXY_PRESET_RE =
4040- /(?<=\/img\/)(default|avatar_thumbnail|avatar|banner|feed_fullsize|feed_thumbnail|download)(?=\/)/
4242+ /(\/img\/)(default|avatar_thumbnail|avatar|banner|feed_fullsize|feed_thumbnail|download)(\/)/
41434244/**
4345 * Replaces any imgproxy preset in a CDN URI with the given preset.
4446 */
4547export function convertCdnPreset(uri: string, preset: ImgproxyPreset): string {
4646- return uri.replace(IMGPROXY_PRESET_RE, preset)
4848+ return uri.replace(IMGPROXY_PRESET_RE, `$1${preset}$3`)
4749}