Skip to content

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

feat: make download-only file always download only

Marc Seitzdb5f0ce5ef41
diff --git a/components/documents/document-header.tsx b/components/documents/document-header.tsx
index 1fd11903..59b6beb2 100644
--- a/components/documents/document-header.tsx
+++ b/components/documents/document-header.tsx
@@ -756,7 +756,9 @@ export default function DocumentHeader({
)}
{primaryVersion.type !== "notion" &&
- primaryVersion.type !== "zip" && (
+ primaryVersion.type !== "zip" &&
+ primaryVersion.type !== "map" &&
+ primaryVersion.type !== "email" && (
<DropdownMenuItem
onClick={() =>
isFree
diff --git a/components/view/view-data.tsx b/components/view/view-data.tsx
index 41ed08bc..60eb3e99 100644
--- a/components/view/view-data.tsx
+++ b/components/view/view-data.tsx
@@ -93,7 +93,9 @@ export default function ViewData({
? viewData.conversationsEnabled
: false),
assistantEnabled: document.assistantEnabled,
- allowDownload: isDownloadAllowed(canDownload, link.allowDownload ?? false),
+ allowDownload:
+ document.downloadOnly ||
+ isDownloadAllowed(canDownload, link.allowDownload ?? false),
isTeamMember: viewData.isTeamMember,
};
diff --git a/pages/api/links/download/index.ts b/pages/api/links/download/index.ts
index e901478d..787a5ea7 100644
--- a/pages/api/links/download/index.ts
+++ b/pages/api/links/download/index.ts
@@ -61,8 +61,8 @@ export default async function handle(
return res.status(404).json({ error: "Error downloading" });
}
- // if link does not allow download, we should not allow the download
- if (!view.link.allowDownload && !view.document?.downloadOnly) {
+ // if document is downloadOnly, always allow. Otherwise, check link settings.
+ if (!view.document?.downloadOnly && !view.link.allowDownload) {
return res.status(403).json({ error: "Error downloading" });
}