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) {
|
||||
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')) {
|
||||
return {
|
||||
url: comment.link,
|
||||
@@ -35,4 +43,4 @@ const getCommentMediaInfo = (comment) => {
|
||||
}
|
||||
};
|
||||
|
||||
export default getCommentMediaInfo;
|
||||
export default getCommentMediaInfo;
|
||||
|
||||
Reference in New Issue
Block a user