fix: content type lower case

This commit is contained in:
Tristan Yang
2024-06-17 17:21:28 +08:00
parent 1067c26477
commit 66a537d993
2 changed files with 5 additions and 4 deletions
+3 -3
View File
@@ -2,7 +2,7 @@ import toast from "react-hot-toast";
import { batch } from "react-redux";
import { ContentTypes } from "../config";
import { addMessage, removeMessage, updateMessage } from "../slices/message";
import { addMessage, removeMessage } from "../slices/message";
import { addChannelMsg, removeChannelMsg } from "../slices/message.channel";
import { addUserMsg, removeUserMsg } from "../slices/message.user";
@@ -19,12 +19,12 @@ export const onMessageSendStarted = async (
{ dispatch, queryFulfilled },
from = "channel"
) => {
// 忽略archive类型的消息
// 忽略 archive 类型的消息
if (type == "archive") return;
// id: who send to ,from_uid: who sent
// console.log("handlers data", content, type, properties, ignoreLocal, id);
const isMedia = properties.content_type
? ["image", "video", "audio"].includes(properties.content_type.split("/")[0])
? ["image", "video", "audio"].includes(properties.content_type.toLowerCase().split("/")[0])
: false;
// const isImage = properties.content_type?.startsWith("image");
const ts = properties.local_id || +new Date();
+2 -1
View File
@@ -69,8 +69,9 @@ export const getLocalAuthData = () => {
};
};
export const isImage = (file_type = "", size = 0) => {
const _fileType = file_type.toLowerCase();
return (
file_type.startsWith("image") && file_type !== "image/x-sony-arw" && size <= FILE_IMAGE_SIZE
_fileType.startsWith("image") && _fileType !== "image/x-sony-arw" && size <= FILE_IMAGE_SIZE
);
};