mirror of
https://github.com/Equicord/Equicord.git
synced 2025-01-18 13:23:28 -05:00
mlenhanced fix?
This commit is contained in:
parent
51e95fff40
commit
00760172ef
2 changed files with 4 additions and 4 deletions
|
@ -113,10 +113,10 @@ export const doesMatch = (type: typeof validIdSearchTypes[number], value: string
|
|||
case "attachment":
|
||||
return message.attachments.length > 0;
|
||||
case "image":
|
||||
return message.attachments.some(a => a.content_type?.startsWith("image")) ||
|
||||
return message.attachments.some(a => a?.content_type?.startsWith("image")) ||
|
||||
message.embeds.some(e => e.image || e.thumbnail);
|
||||
case "video":
|
||||
return message.attachments.some(a => a.content_type?.startsWith("video")) ||
|
||||
return message.attachments.some(a => a?.content_type?.startsWith("video")) ||
|
||||
message.embeds.some(e => e.video);
|
||||
case "embed":
|
||||
return message.embeds.length > 0;
|
||||
|
|
|
@ -57,7 +57,7 @@ export function isAttachmentGoodToCache(attachment: MessageAttachment, fileExten
|
|||
export async function cacheMessageImages(message: LoggedMessage | LoggedMessageJSON) {
|
||||
try {
|
||||
for (const attachment of message.attachments) {
|
||||
const fileExtension = getFileExtension(attachment.filename ?? attachment.url) ?? attachment.content_type?.split("/")?.[1] ?? ".png";
|
||||
const fileExtension = getFileExtension(attachment.filename ?? attachment.url) ?? attachment?.content_type?.split("/")?.[1] ?? ".png";
|
||||
|
||||
if (!isAttachmentGoodToCache(attachment, fileExtension)) {
|
||||
Flogger.log("skipping", attachment.filename);
|
||||
|
@ -68,7 +68,7 @@ export async function cacheMessageImages(message: LoggedMessage | LoggedMessageJ
|
|||
attachment.oldProxyUrl = attachment.proxy_url;
|
||||
|
||||
// only normal urls work if theres a charset in the content type /shrug
|
||||
if (attachment.content_type?.includes(";")) {
|
||||
if (attachment?.content_type?.includes(";")) {
|
||||
attachment.proxy_url = attachment.url;
|
||||
} else {
|
||||
// apparently proxy urls last longer
|
||||
|
|
Loading…
Reference in a new issue