Restore the community photo after reload and reject empty, oversized, SVG, and spoofed uploads.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
extensionForMime,
|
||||
isAllowedMime,
|
||||
isValidUploadFileId,
|
||||
maxBytesForPurpose,
|
||||
} from "../../lib/server/uploads/uploadConstants";
|
||||
@@ -12,18 +11,6 @@ describe("createFlow upload constants", () => {
|
||||
expect(maxBytesForPurpose("customMethodAttachment")).toBe(10 * 1024 * 1024);
|
||||
});
|
||||
|
||||
it("isAllowedMime allows images for both purposes", () => {
|
||||
expect(isAllowedMime("communityAvatar", "image/png")).toBe(true);
|
||||
expect(isAllowedMime("customMethodAttachment", "image/jpeg")).toBe(true);
|
||||
});
|
||||
|
||||
it("isAllowedMime allows pdf only for customMethodAttachment", () => {
|
||||
expect(isAllowedMime("communityAvatar", "application/pdf")).toBe(false);
|
||||
expect(isAllowedMime("customMethodAttachment", "application/pdf")).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
it("extensionForMime maps common types", () => {
|
||||
expect(extensionForMime("image/png")).toBe(".png");
|
||||
expect(extensionForMime("image/jpeg")).toBe(".jpg");
|
||||
|
||||
Reference in New Issue
Block a user