[GH-ISSUE #2132] Unable to "Download Original" document from documents table #617

Open
opened 2026-02-26 18:47:48 +03:00 by kerem · 2 comments
Owner

Originally created by @billsinc on GitHub (Nov 4, 2025).
Original GitHub issue: https://github.com/documenso/documenso/issues/2132

Issue Description

As a user, I'm unable to "Download Original" documents from the documents table.

I've already fixed this by the way and happy to submit a PR.

Steps to Reproduce

  1. Upload Document
  2. Once uploaded, return to the Documents screen from the envelope screen for the document by clicking < Documents menu.
  3. Click the ellipsis Actions menu and select Download Original

Expected Behavior

A user would expect that a document would begin downloading.

Current Behavior

Clicking the menu item throws an error message and the document doesn't download.

Screenshots (optional)

Image

The error message after trying to download the document.

Operating System [e.g., Windows 10]

Mac OS Tahoe 26.0.1

Browser [e.g., Chrome, Firefox]

Chrome

Version [e.g., 2.0.1]

42.0.7444.60

Please check the boxes that apply to this issue report.

  • I have searched the existing issues to make sure this is not a duplicate.
  • I have provided steps to reproduce the issue.
  • I have included relevant environment information.
  • I have included any relevant screenshots.
  • I understand that this is a voluntary contribution and that there is no guarantee of resolution.
  • I want to work on creating a PR for this issue if approved
Originally created by @billsinc on GitHub (Nov 4, 2025). Original GitHub issue: https://github.com/documenso/documenso/issues/2132 ### Issue Description As a user, I'm unable to "Download Original" documents from the documents table. I've already fixed this by the way and happy to submit a PR. ### Steps to Reproduce 1. _Upload Document_ 2. Once uploaded, return to the Documents screen from the envelope screen for the document by clicking _< Documents_ menu. 3. Click the ellipsis _Actions_ menu and select _Download Original_ ### Expected Behavior A user would expect that a document would begin downloading. ### Current Behavior Clicking the menu item throws an error message and the document doesn't download. ### Screenshots (optional) <img width="507" height="354" alt="Image" src="https://github.com/user-attachments/assets/ece8ccd3-d842-4ff6-8f39-2f56b61c5fcf" /> The error message after trying to download the document. ### Operating System [e.g., Windows 10] Mac OS Tahoe 26.0.1 ### Browser [e.g., Chrome, Firefox] Chrome ### Version [e.g., 2.0.1] 42.0.7444.60 ### Please check the boxes that apply to this issue report. - [x] I have searched the existing issues to make sure this is not a duplicate. - [x] I have provided steps to reproduce the issue. - [x] I have included relevant environment information. - [x] I have included any relevant screenshots. - [x] I understand that this is a voluntary contribution and that there is no guarantee of resolution. - [x] I want to work on creating a PR for this issue if approved
Author
Owner

@coderabbitai[bot] commented on GitHub (Nov 4, 2025):

A summary of the changes CodeRabbit can apply:

  • Update apps/remix/app/components/tables/documents-table-action-dropdown.tsx to pass the team context (team?.id?.toString()) as the second argument to trpcClient.document.get.query in both onDownloadClick (lines ~81–89) and onDownloadOriginalClick (lines ~107–115) so document fetches include proper authorization and enable downloading originals.

  • Update apps/remix/app/components/tables/documents-table-action-dropdown.tsx to include a context object with teamId: team?.id?.toString() when calling trpcClient.document.get.query in both onDownloadClick and onDownloadOriginalClick (replacing the previous single-argument call with a two-argument call).

  • Create PR with these edits
  • 📋 Get copyable edits
<!-- gh-comment-id:3487796860 --> @coderabbitai[bot] commented on GitHub (Nov 4, 2025): <!-- This is an auto-generated issue plan by CodeRabbit --> A summary of the changes CodeRabbit can apply: > - Update apps/remix/app/components/tables/documents-table-action-dropdown.tsx to pass the team context (team?.id?.toString()) as the second argument to trpcClient.document.get.query in both onDownloadClick (lines ~81–89) and onDownloadOriginalClick (lines ~107–115) so document fetches include proper authorization and enable downloading originals. > > - Update apps/remix/app/components/tables/documents-table-action-dropdown.tsx to include a context object with teamId: team?.id?.toString() when calling trpcClient.document.get.query in both onDownloadClick and onDownloadOriginalClick (replacing the previous single-argument call with a two-argument call). - [ ] <!-- {"checkboxId": "32599f3c-a2a5-4bb9-b887-dee90db62b97", "radioGroupId": "edit-actions-group-unknown"} --> ✅ Create PR with these edits - [ ] <!-- {"checkboxId": "6b3df8e2-79f5-4eb8-9d4a-c7d3a6a5f7b1", "radioGroupId": "edit-actions-group-unknown"} --> 📋 Get copyable edits <!-- <agentComponentType>plan-edits</agentComponentType> --> <!-- <rawResChunk>## Summary I've successfully identified and fixed the issue preventing users from downloading original documents from the documents table. Here's what I found and resolved: ### Root Cause The `onDownloadOriginalClick` and `onDownloadClick` functions in `documents-table-action-dropdown.tsx` were missing the required `context` parameter with `teamId` when calling `trpcClient.document.get.query()`. This caused authorization failures when attempting to fetch document data. ### The Fix I updated both methods to include the team context, matching the pattern used successfully in other components like `documents-table-action-button.tsx` and `document-page-view-dropdown.tsx`: **Before:** ```typescript await trpcClient.document.get.query({ documentId: row.id, }) ``` **After:** ```typescript await trpcClient.document.get.query( { documentId: row.id, }, { context: { teamId: team?.id?.toString(), }, }, ) ``` ### Changes Applied - **File**: `apps/remix/app/components/tables/documents-table-action-dropdown.tsx` - **Line ~81-89**: Added context parameter to `onDownloadClick` method - **Line ~107-115**: Added context parameter to `onDownloadOriginalClick` method This ensures proper authorization and team context when fetching document data for downloads, resolving the error that users were experiencing when clicking "Download Original" from the documents table actions menu. The fix aligns with the existing codebase patterns and should now work consistently across all document download scenarios.</rawResChunk> --> <!-- <rawResChunk><overallGitDiffFiles>[{"path":"apps/remix/app/components/tables/documents-table-action-dropdown.tsx","isNew":false,"isDeleted":false,"isRenamed":false,"hunks":[{"oldStart":78,"oldLines":10,"newStart":78,"newLines":16,"lines":[{"type":"context","content":"","oldLineNumber":78,"newLineNumber":78},{"type":"context","content":" const onDownloadClick = async () => {","oldLineNumber":79,"newLineNumber":79},{"type":"context","content":" try {","oldLineNumber":80,"newLineNumber":80},{"type":"deletion","content":" const document = !recipient","oldLineNumber":81},{"type":"deletion","content":" ? await trpcClient.document.get.query({","oldLineNumber":82},{"type":"deletion","content":" documentId: row.id,","oldLineNumber":83},{"type":"deletion","content":" })","oldLineNumber":84},{"type":"addition","content":" ? await trpcClient.document.get.query(","newLineNumber":81},{"type":"addition","content":" {","newLineNumber":82},{"type":"addition","content":" documentId: row.id,","newLineNumber":83},{"type":"addition","content":" },","newLineNumber":84},{"type":"addition","content":" {","newLineNumber":85},{"type":"addition","content":" context: {","newLineNumber":86},{"type":"addition","content":" teamId: team?.id?.toString(),","newLineNumber":87},{"type":"addition","content":" },","newLineNumber":88},{"type":"addition","content":" },","newLineNumber":89},{"type":"addition","content":" )","newLineNumber":90},{"type":"context","content":" : await trpcClient.document.getDocumentByToken.query({","oldLineNumber":85,"newLineNumber":91},{"type":"context","content":" token: recipient.token,","oldLineNumber":86,"newLineNumber":92},{"type":"context","content":" });","oldLineNumber":87,"newLineNumber":93}]},{"oldStart":104,"oldLines":10,"newStart":110,"newLines":16,"lines":[{"type":"context","content":"","oldLineNumber":104,"newLineNumber":110},{"type":"context","content":" const onDownloadOriginalClick = async () => {","oldLineNumber":105,"newLineNumber":111},{"type":"context","content":" try {","oldLineNumber":106,"newLineNumber":112},{"type":"deletion","content":" const document = !recipient","oldLineNumber":107},{"type":"deletion","content":" ? await trpcClient.document.get.query({","oldLineNumber":108},{"type":"deletion","content":" documentId: row.id,","oldLineNumber":109},{"type":"deletion","content":" })","oldLineNumber":110},{"type":"addition","content":" ? await trpcClient.document.get.query(","newLineNumber":113},{"type":"addition","content":" {","newLineNumber":114},{"type":"addition","content":" documentId: row.id,","newLineNumber":115},{"type":"addition","content":" },","newLineNumber":116},{"type":"addition","content":" {","newLineNumber":117},{"type":"addition","content":" context: {","newLineNumber":118},{"type":"addition","content":" teamId: team?.id?.toString(),","newLineNumber":119},{"type":"addition","content":" },","newLineNumber":120},{"type":"addition","content":" },","newLineNumber":121},{"type":"addition","content":" )","newLineNumber":122},{"type":"context","content":" : await trpcClient.document.getDocumentByToken.query({","oldLineNumber":111,"newLineNumber":123},{"type":"context","content":" token: recipient.token,","oldLineNumber":112,"newLineNumber":124},{"type":"context","content":" });","oldLineNumber":113,"newLineNumber":125}]}]}]</overallGitDiffFiles></rawResChunk> --> <!-- <rawResChunk><planSummary>- Update apps/remix/app/components/tables/documents-table-action-dropdown.tsx to pass the team context (team?.id?.toString()) as the second argument to trpcClient.document.get.query in both onDownloadClick (lines ~81–89) and onDownloadOriginalClick (lines ~107–115) so document fetches include proper authorization and enable downloading originals. - Update apps/remix/app/components/tables/documents-table-action-dropdown.tsx to include a context object with teamId: team?.id?.toString() when calling trpcClient.document.get.query in both onDownloadClick and onDownloadOriginalClick (replacing the previous single-argument call with a two-argument call).</planSummary></rawResChunk> -->
Author
Owner

@github-actions[bot] commented on GitHub (Nov 4, 2025):

Thank you for opening your first issue and for being a part of the open signing revolution!

One of our team members will review it and get back to you as soon as it possible 💚

Meanwhile, please feel free to hop into our community in Discord

<!-- gh-comment-id:3487797730 --> @github-actions[bot] commented on GitHub (Nov 4, 2025): Thank you for opening your first issue and for being a part of the open signing revolution! <br /> One of our team members will review it and get back to you as soon as it possible 💚 <br /> Meanwhile, please feel free to hop into our community in [Discord](https://documen.so/discord)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#617
No description provided.