Skip to content

Commit

Permalink
Merge pull request #1122 from mfts/fix/bulk-dl
Browse files Browse the repository at this point in the history
fix: download original file type
  • Loading branch information
mfts authored Oct 18, 2024
2 parents a11aa90 + 66dfefe commit 7c68369
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 0 additions & 2 deletions lib/files/get-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 6 additions & 2 deletions pages/api/links/download/bulk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export default async function handle(
type: true,
file: true,
storageType: true,
originalFile: true,
contentType: true,
},
take: 1,
},
Expand Down Expand Up @@ -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,
),
);

Expand All @@ -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,
),
);

Expand Down
6 changes: 5 additions & 1 deletion pages/api/links/download/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export default async function handle(
file: true,
storageType: true,
numPages: true,
originalFile: true,
contentType: true,
},
take: 1,
},
Expand Down Expand Up @@ -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,
});

Expand Down

0 comments on commit 7c68369

Please sign in to comment.