Skip to content

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

Add support for .log files as download-only documents

Cursor Agentc2e179763212
diff --git a/components/document-upload.tsx b/components/document-upload.tsx
index c12f63dc..f45a5e1c 100644
--- a/components/document-upload.tsx
+++ b/components/document-upload.tsx
@@ -192,7 +192,7 @@ export default function DocumentUpload({
? "Replace file?"
: isFree && !isTrial
? `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`}
+ : `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, *.log`}
</p>
</div>
</div>
diff --git a/components/upload-zone.tsx b/components/upload-zone.tsx
index 690fd2d6..ce408610 100644
--- a/components/upload-zone.tsx
+++ b/components/upload-zone.tsx
@@ -1203,7 +1203,7 @@ export default function UploadZone({
<p className="mt-1 text-xs leading-5 text-muted-foreground">
{isFree && !isTrial
? `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`}
+ : `Only *.pdf, *.pptx, *.docx, *.xlsx, *.xls, *.csv, *.tsv, *.ods, *.ppt, *.odp, *.doc, *.odt, *.dwg, *.dxf, *.png, *.jpg, *.jpeg, *.mp4, *.mov, *.avi, *.webm, *.ogg, *.log`}
</p>
</div>
</div>
diff --git a/lib/api/documents/process-document.ts b/lib/api/documents/process-document.ts
index 441ac69e..0ec041b1 100644
--- a/lib/api/documents/process-document.ts
+++ b/lib/api/documents/process-document.ts
@@ -119,13 +119,16 @@ export const processDocument = async ({
},
});
+ const isLogFile = name.toLowerCase().endsWith(".log");
+
// determine if the document is download only
const isDownloadOnly =
type === "zip" ||
type === "map" ||
type === "email" ||
contentType === "text/tab-separated-values" ||
- type === "cad";
+ type === "cad" ||
+ isLogFile;
// Save data to the database
const document = await prisma.document.create({
@@ -195,7 +198,7 @@ export const processDocument = async ({
concurrencyKey: teamId,
},
);
- } else if (type === "docs" || type === "slides") {
+ } else if ((type === "docs" || type === "slides") && !isLogFile) {
await convertFilesToPdfTask.trigger(
{
documentId: document.id,
diff --git a/lib/constants.ts b/lib/constants.ts
index 953e065c..36bd0d9a 100644
--- a/lib/constants.ts
+++ b/lib/constants.ts
@@ -137,7 +137,7 @@ export const FULL_PLAN_ACCEPTED_FILE_TYPES = {
"application/vnd.oasis.opendocument.text": [], // ".odt"
"application/rtf": [], // ".rtf"
"text/rtf": [], // ".rtf"
- "text/plain": [], // ".txt"
+ "text/plain": [".log"], // ".txt", ".log"
"image/vnd.dwg": [".dwg"], // ".dwg"
"image/vnd.dxf": [".dxf"], // ".dxf"
"image/png": [], // ".png"
@@ -178,7 +178,7 @@ export const VIEWER_ACCEPTED_FILE_TYPES = {
"application/vnd.oasis.opendocument.text": [], // ".odt"
"application/rtf": [], // ".rtf"
"text/rtf": [], // ".rtf"
- "text/plain": [], // ".txt"
+ "text/plain": [".log"], // ".txt", ".log"
"image/png": [], // ".png"
"image/jpeg": [], // ".jpeg"
"image/jpg": [], // ".jpg"
diff --git a/pages/api/teams/[teamId]/documents/[id]/versions/index.ts b/pages/api/teams/[teamId]/documents/[id]/versions/index.ts
index 09c679d6..b55c1941 100644
--- a/pages/api/teams/[teamId]/documents/[id]/versions/index.ts
+++ b/pages/api/teams/[teamId]/documents/[id]/versions/index.ts
@@ -154,7 +154,9 @@ export default async function handle(
},
});
- if (type === "docs" || type === "slides") {
+ const isLogFile = url.toLowerCase().endsWith(".log");
+
+ if ((type === "docs" || type === "slides") && !isLogFile) {
await convertFilesToPdfTask.trigger(
{
documentVersionId: version.id,
diff --git a/pages/api/teams/[teamId]/documents/agreement.ts b/pages/api/teams/[teamId]/documents/agreement.ts
index 78b5d175..abe5d020 100644
--- a/pages/api/teams/[teamId]/documents/agreement.ts
+++ b/pages/api/teams/[teamId]/documents/agreement.ts
@@ -130,7 +130,9 @@ export default async function handle(
},
});
- if (type === "docs") {
+ const isLogFile = name.toLowerCase().endsWith(".log");
+
+ if (type === "docs" && !isLogFile) {
await convertFilesToPdfTask.trigger(
{
documentId: document.id,