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
+8 -4
View File
@@ -696,11 +696,15 @@ 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,
const parts = playerUrl.pathname.split('/') // so fall back to the link card instead of returning a broken player.
parts[parts.length - 1] = `${slug}.${ext}` if (!slug) {
playerUrl.pathname = parts.join('/') return {success: false}
} }
const parts = playerUrl.pathname.split('/')
parts[parts.length - 1] = `${slug}.${ext}`
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