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

Commit

Permalink
fix: prevent uploading invalid aspect ratios
Browse files Browse the repository at this point in the history
  • Loading branch information
lennartkloock committed Oct 25, 2024
1 parent 7042b2d commit 80186ac
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/views/emote-upload/EmoteUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ const handleFile = async (file: File) => {
if (w > 1000 || h > 1000) {
uploadError.value = "Image is too large (must be less than 1000x1000)";
}
const aspectRatio = w / h;
if (aspectRatio > 3.0) {
uploadError.value = "Image aspect ratio is too large (must be less than 3:1)";
} else if (aspectRatio < 1 / 32) {
uploadError.value = "Image aspect ratio is too small (must be more than 1:32)";
}
};
}
Expand Down

0 comments on commit 80186ac

Please sign in to comment.