Skip to content

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

fix: download original file type

Marc Seitz66dfefe346f0
diff --git a/lib/files/get-file.ts b/lib/files/get-file.ts
index 7182c0ed..8b556a21 100644
--- a/lib/files/get-file.ts
+++ b/lib/files/get-file.ts
@@ -13,8 +13,6 @@ export const getFile = async ({
data,
isDownload = false,
}: GetFileOptions) => {
- console.log("type", type);
-
const url = await match(type)
.with(DocumentStorageType.VERCEL_BLOB, () => {
if (isDownload) {
diff --git a/pages/api/links/download/bulk.ts b/pages/api/links/download/bulk.ts
index 0d9ea8a0..4277022b 100644
--- a/pages/api/links/download/bulk.ts
+++ b/pages/api/links/download/bulk.ts
@@ -58,6 +58,8 @@ export default async function handle(
type: true,
file: true,
storageType: true,
+ originalFile: true,
+ contentType: true,
},
take: 1,
},
@@ -219,7 +221,8 @@ export default async function handle(
addFileToStructure(
"/",
doc.document.name,
- doc.document.versions[0].file,
+ doc.document.versions[0].originalFile ??
+ doc.document.versions[0].file,
),
);
@@ -237,7 +240,8 @@ export default async function handle(
addFileToStructure(
folder.path,
doc.document.name,
- doc.document.versions[0].file,
+ doc.document.versions[0].originalFile ??
+ doc.document.versions[0].file,
),
);
diff --git a/pages/api/links/download/index.ts b/pages/api/links/download/index.ts
index 3f949fb7..cb0ff083 100644
--- a/pages/api/links/download/index.ts
+++ b/pages/api/links/download/index.ts
@@ -42,6 +42,8 @@ export default async function handle(
file: true,
storageType: true,
numPages: true,
+ originalFile: true,
+ contentType: true,
},
take: 1,
},
@@ -100,7 +102,9 @@ export default async function handle(
const downloadUrl = await getFile({
type: view.document!.versions[0].storageType,
- data: view.document!.versions[0].file,
+ data:
+ view.document!.versions[0].originalFile ??
+ view.document!.versions[0].file,
isDownload: true,
});