Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: validation

Marc Seitzc2aabcb617cb
diff --git a/lib/documents/create-document.ts b/lib/documents/create-document.ts
index 6047605d..00c8907b 100644
--- a/lib/documents/create-document.ts
+++ b/lib/documents/create-document.ts
@@ -5,7 +5,7 @@ export type DocumentData = {
name: string;
key: string;
storageType: DocumentStorageType;
- contentType: string; // actual file mime type
+ contentType: string | null; // actual file mime type
supportedFileType: string; // papermark types: "pdf", "sheet", "docs", "slides", "map", "zip"
fileSize: number | undefined; // file size in bytes
numPages?: number;
diff --git a/lib/zod/url-validation.ts b/lib/zod/url-validation.ts
index a32a76db..1e1da770 100644
--- a/lib/zod/url-validation.ts
+++ b/lib/zod/url-validation.ts
@@ -144,7 +144,7 @@ export const documentUploadSchema = z
.enum(["S3_PATH", "VERCEL_BLOB"], {
errorMap: () => ({ message: "Invalid storage type" }),
})
- .optional(),
+ .default("VERCEL_BLOB"),
numPages: z.number().int().positive().optional(),
type: z.enum(
SUPPORTED_DOCUMENT_SIMPLE_TYPES as unknown as readonly [
@@ -169,7 +169,7 @@ export const documentUploadSchema = z
},
)
.or(z.literal("text/html")) // Allow text/html for Notion documents
- .optional(), // Make contentType optional for Notion files
+ .nullable(), // Make contentType optional for Notion files
createLink: z.boolean().optional(),
fileSize: z.number().int().positive().optional(),
})