mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix getCommentMediaInfo
This commit is contained in:
@@ -11,7 +11,15 @@ const getCommentMediaInfo = (comment) => {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (comment?.link) {
|
if (comment?.link) {
|
||||||
const mime = extName(new URL(comment?.link).pathname.replace('/', ''))[0]?.mime
|
try {
|
||||||
|
new URL(comment.link);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Invalid URL:", comment.link);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const mime = extName(new URL(comment?.link).pathname.replace('/', ''))[0]?.mime;
|
||||||
|
|
||||||
if (mime?.startsWith('image')) {
|
if (mime?.startsWith('image')) {
|
||||||
return {
|
return {
|
||||||
url: comment.link,
|
url: comment.link,
|
||||||
@@ -35,4 +43,4 @@ const getCommentMediaInfo = (comment) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default getCommentMediaInfo;
|
export default getCommentMediaInfo;
|
||||||
|
|||||||
Reference in New Issue
Block a user