fallback to link card on web if no slug
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user