fix(post): some links to images could be embedded as videos

same as https://github.com/plebbit/seedit/issues/385
This commit is contained in:
Tom (plebeius.eth)
2024-10-11 22:01:33 +02:00
parent 561e395256
commit 46e1189711
+3 -1
View File
@@ -80,7 +80,8 @@ export const getLinkMediaInfo = memoize(
} }
try { try {
const fileName = url.pathname.slice(url.pathname.lastIndexOf('/') + 1).toLowerCase(); const fileName = url.pathname.split('/').pop() || '';
if (fileName.includes('.')) {
mime = extName(fileName)[0]?.mime; mime = extName(fileName)[0]?.mime;
if (mime) { if (mime) {
if (mime.startsWith('image')) { if (mime.startsWith('image')) {
@@ -91,6 +92,7 @@ export const getLinkMediaInfo = memoize(
type = 'audio'; type = 'audio';
} }
} }
}
if (canEmbed(url) || url.host.startsWith('yt.')) { if (canEmbed(url) || url.host.startsWith('yt.')) {
type = 'iframe'; type = 'iframe';