fallback to link card on web if no slug

This commit is contained in:
vineyardbovines
2026-04-17 08:34:25 -04:00
parent 47706b95b4
commit eb914cdf6b
+6 -2
View File
@@ -696,12 +696,16 @@ export function parseKlipyGif(urlp: URL):
const slug = IS_WEB_SAFARI ? mp4Slug : webmSlug const slug = IS_WEB_SAFARI ? mp4Slug : webmSlug
const ext = IS_WEB_SAFARI ? 'mp4' : 'webm' const ext = IS_WEB_SAFARI ? 'mp4' : 'webm'
if (slug) { // Without a slug we can't produce a playable video URL on web,
// so fall back to the link card instead of returning a broken player.
if (!slug) {
return {success: false}
}
const parts = playerUrl.pathname.split('/') const parts = playerUrl.pathname.split('/')
parts[parts.length - 1] = `${slug}.${ext}` parts[parts.length - 1] = `${slug}.${ext}`
playerUrl.pathname = parts.join('/') playerUrl.pathname = parts.join('/')
} }
}
// Strip all metadata params — only the path matters for the CDN // Strip all metadata params — only the path matters for the CDN
playerUrl.searchParams.delete('hh') playerUrl.searchParams.delete('hh')