check file type properly

This commit is contained in:
ThatOneCalculator 2023-10-02 23:37:43 -07:00
parent 303ae1c844
commit c95d143065
No known key found for this signature in database
GPG key ID: 8703CACD01000000

View file

@ -78,7 +78,7 @@ function toggleSensitive(file) {
} }
function cropImage(file) { function cropImage(file) {
if (file.type !== "image") return; if (!["png", "webp", "jpg", "jpeg"].includes(file.type)) return;
os.cropImage(file).then((newFile) => { os.cropImage(file).then((newFile) => {
emits("cropImage", newFile); emits("cropImage", newFile);
}); });
@ -155,7 +155,7 @@ function showFileMenu(file, ev: MouseEvent) {
describe(file); describe(file);
}, },
}, },
file.type === "image" ? { ["png", "webp", "jpg", "jpeg"].includes(file.type) ? {
text: i18n.ts.cropImage, text: i18n.ts.cropImage,
icon: "ph-crop ph-bold ph-lg", icon: "ph-crop ph-bold ph-lg",
action: () => { action: () => {