mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(post): a non-direct link could be marked as media instead of webpage
This commit is contained in:
@@ -80,20 +80,21 @@ export const getLinkMediaInfo = memoize(
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const fileName = url.pathname.split('/').pop() || '';
|
mime = extName(new URL(link).pathname.toLowerCase().replace('/', ''))[0]?.mime;
|
||||||
if (fileName.includes('.')) {
|
if (mime) {
|
||||||
mime = extName(fileName)[0]?.mime;
|
if (mime.startsWith('image')) {
|
||||||
if (mime) {
|
type = mime === 'image/gif' ? 'gif' : 'image';
|
||||||
if (mime.startsWith('image')) {
|
} else if (mime.startsWith('video')) {
|
||||||
type = mime === 'image/gif' ? 'gif' : 'image';
|
type = 'video';
|
||||||
} else if (mime.startsWith('video')) {
|
} else if (mime.startsWith('audio')) {
|
||||||
type = 'video';
|
type = 'audio';
|
||||||
} else if (mime.startsWith('audio')) {
|
|
||||||
type = 'audio';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!url.pathname.includes('.')) {
|
||||||
|
type = 'webpage';
|
||||||
|
}
|
||||||
|
|
||||||
if (canEmbed(url) || url.host.startsWith('yt.')) {
|
if (canEmbed(url) || url.host.startsWith('yt.')) {
|
||||||
type = 'iframe';
|
type = 'iframe';
|
||||||
patternThumbnailUrl = getPatternThumbnailUrl(url);
|
patternThumbnailUrl = getPatternThumbnailUrl(url);
|
||||||
|
|||||||
Reference in New Issue
Block a user