mirror of
https://github.com/formbricks/formbricks.git
synced 2026-05-11 19:12:06 -05:00
fix: show oversized upload error when mime type is missing (#7757)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This commit is contained in:
@@ -67,6 +67,15 @@ describe("File Input Utils", () => {
|
||||
expect(toast.error).toHaveBeenCalledWith(expect.stringContaining("File exceeds 5 MB size limit."));
|
||||
});
|
||||
|
||||
test("should show size error for oversized files even when mime type is empty", async () => {
|
||||
const files = [new File(["x".repeat(101000)], "large.ico", { type: "" })];
|
||||
|
||||
const result = await getAllowedFiles(files, ["ico"], 0.1);
|
||||
|
||||
expect(result).toHaveLength(0);
|
||||
expect(toast.error).toHaveBeenCalledWith(expect.stringContaining("File exceeds 0.1 MB size limit."));
|
||||
});
|
||||
|
||||
test("should convert HEIC files to JPEG", async () => {
|
||||
const heicFile = new File(["test"], "test.heic", { type: "image/heic" });
|
||||
const mockConvertedFile = new File(["converted"], "test.jpg", { type: "image/jpeg" });
|
||||
|
||||
@@ -21,7 +21,7 @@ export const getAllowedFiles = async (
|
||||
const convertedFiles: File[] = [];
|
||||
|
||||
for (const file of files) {
|
||||
if (!file || !file.type) {
|
||||
if (!file) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user