Skip to content
This repository was archived by the owner on Dec 16, 2024. It is now read-only.

Commit 80186ac

Browse files
committed
fix: prevent uploading invalid aspect ratios
1 parent 7042b2d commit 80186ac

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/views/emote-upload/EmoteUpload.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,13 @@ const handleFile = async (file: File) => {
210210
if (w > 1000 || h > 1000) {
211211
uploadError.value = "Image is too large (must be less than 1000x1000)";
212212
}
213+
214+
const aspectRatio = w / h;
215+
if (aspectRatio > 3.0) {
216+
uploadError.value = "Image aspect ratio is too large (must be less than 3:1)";
217+
} else if (aspectRatio < 1 / 32) {
218+
uploadError.value = "Image aspect ratio is too small (must be more than 1:32)";
219+
}
213220
};
214221
}
215222

0 commit comments

Comments
 (0)