Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
Add support for TSV files
Cursor Agent1c297ba9b893
diff --git a/components/document-upload.tsx b/components/document-upload.tsxindex 8729ae29..c12f63dc 100644--- a/components/document-upload.tsx+++ b/components/document-upload.tsx@@ -191,8 +191,8 @@ export default function DocumentUpload({{currentFile? "Replace file?": isFree && !isTrial- ? `Only *.pdf, *.xls, *.xlsx, *.csv, *.ods, *.png, *.jpeg, *.jpg`- : `Only *.pdf, *.pptx, *.docx, *.xlsx, *.xls, *.xlsm, *.csv, *.ods, *.ppt, *.odp, *.doc, *.odt, *.rtf, *txt, *.dwg, *.dxf, *.png, *.jpg, *.jpeg, *.mp4, *.mov, *.avi, *.webm, *.ogg`}+ ? `Only *.pdf, *.xls, *.xlsx, *.csv, *.tsv, *.ods, *.png, *.jpeg, *.jpg`+ : `Only *.pdf, *.pptx, *.docx, *.xlsx, *.xls, *.xlsm, *.csv, *.tsv, *.ods, *.ppt, *.odp, *.doc, *.odt, *.rtf, *txt, *.dwg, *.dxf, *.png, *.jpg, *.jpeg, *.mp4, *.mov, *.avi, *.webm, *.ogg`}</p></div></div>diff --git a/components/ui/file-upload.tsx b/components/ui/file-upload.tsxindex 4393457d..bd10ccc4 100644--- a/components/ui/file-upload.tsx+++ b/components/ui/file-upload.tsx@@ -19,8 +19,8 @@ const acceptFileTypes: Record<errorMessage: "File type not supported (.png or .jpg only)",},csv: {- types: ["text/csv"],- errorMessage: "File type not supported (.csv only)",+ types: ["text/csv", "text/tab-separated-values"],+ errorMessage: "File type not supported (.csv or .tsv only)",},};diff --git a/components/upload-zone.tsx b/components/upload-zone.tsxindex 065423a8..91b2b543 100644--- a/components/upload-zone.tsx+++ b/components/upload-zone.tsx@@ -718,8 +718,8 @@ export default function UploadZone({</span><p className="mt-1 text-xs leading-5 text-muted-foreground">{isFree && !isTrial- ? `Only *.pdf, *.xls, *.xlsx, *.csv, *.ods, *.png, *.jpeg, *.jpg`- : `Only *.pdf, *.pptx, *.docx, *.xlsx, *.xls, *.csv, *.ods, *.ppt, *.odp, *.doc, *.odt, *.dwg, *.dxf, *.png, *.jpg, *.jpeg, *.mp4, *.mov, *.avi, *.webm, *.ogg`}+ ? `Only *.pdf, *.xls, *.xlsx, *.csv, *.tsv, *.ods, *.png, *.jpeg, *.jpg`+ : `Only *.pdf, *.pptx, *.docx, *.xlsx, *.xls, *.csv, *.tsv, *.ods, *.ppt, *.odp, *.doc, *.odt, *.dwg, *.dxf, *.png, *.jpg, *.jpeg, *.mp4, *.mov, *.avi, *.webm, *.ogg`}</p></div></div>diff --git a/components/viewer-upload-zone.tsx b/components/viewer-upload-zone.tsxindex 16a3d958..c9df2bb8 100644--- a/components/viewer-upload-zone.tsx+++ b/components/viewer-upload-zone.tsx@@ -186,7 +186,7 @@ export default function ViewerUploadZone({Drop your file(s) here</span><p className="mt-1 text-xs leading-5 text-muted-foreground">- Only *.pdf, *.xls, *.xlsx, *.csv, *.ods files+ Only *.pdf, *.xls, *.xlsx, *.csv, *.tsv, *.ods files</p></div></div>diff --git a/lib/api/documents/process-document.ts b/lib/api/documents/process-document.tsindex f5860132..18a67aee 100644--- a/lib/api/documents/process-document.ts+++ b/lib/api/documents/process-document.ts@@ -85,7 +85,7 @@ export const processDocument = async ({});// determine if the document is download only- const isDownloadOnly = type === "zip" || type === "map" || type === "email";+ const isDownloadOnly = type === "zip" || type === "map" || type === "email" || type === "tsv";// Save data to the databaseconst document = await prisma.document.create({diff --git a/lib/constants.ts b/lib/constants.tsindex 5c45a2fb..d8138be0 100644--- a/lib/constants.ts+++ b/lib/constants.ts@@ -70,6 +70,7 @@ export const SUPPORTED_DOCUMENT_MIME_TYPES = ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", // .xlsx"application/vnd.ms-excel.sheet.macroEnabled.12", // .xlsm"text/csv", // .csv+ "text/tab-separated-values", // .tsv"application/vnd.oasis.opendocument.spreadsheet", // .ods"application/vnd.ms-powerpoint", // .ppt"application/vnd.openxmlformats-officedocument.presentationml.presentation", // .pptx@@ -119,6 +120,7 @@ export const FULL_PLAN_ACCEPTED_FILE_TYPES = {"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [], // ".xlsx""application/vnd.ms-excel.sheet.macroEnabled.12": [".xlsm"], // ".xlsm""text/csv": [], // ".csv"+ "text/tab-separated-values": [], // ".tsv""application/vnd.oasis.opendocument.spreadsheet": [], // ".ods""application/vnd.ms-powerpoint": [], // ".ppt""application/vnd.openxmlformats-officedocument.presentationml.presentation":diff --git a/lib/utils/get-content-type.ts b/lib/utils/get-content-type.tsindex 9d396825..fe2e9fb0 100644--- a/lib/utils/get-content-type.ts+++ b/lib/utils/get-content-type.ts@@ -6,6 +6,7 @@ export function getSupportedContentType(contentType: string): string | null {case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":case "application/vnd.ms-excel.sheet.macroEnabled.12":case "text/csv":+ case "text/tab-separated-values":case "application/vnd.oasis.opendocument.spreadsheet":return "sheet";case "application/msword":@@ -63,6 +64,8 @@ export function getExtensionFromContentType(return "xlsm";case "text/csv":return "csv";+ case "text/tab-separated-values":+ return "tsv";case "application/vnd.oasis.opendocument.spreadsheet":return "ods";case "application/vnd.openxmlformats-officedocument.wordprocessingml.document":diff --git a/lib/utils/get-file-icon.tsx b/lib/utils/get-file-icon.tsxindex 187236ed..13935e5a 100644--- a/lib/utils/get-file-icon.tsx+++ b/lib/utils/get-file-icon.tsx@@ -41,6 +41,7 @@ export function fileIcon({case "application/vnd.ms-excel":case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":case "text/csv":+ case "text/tab-separated-values":case "application/vnd.oasis.opendocument.spreadsheet":case "sheet":return <SheetIcon className={className} isLight={isLight} />;