fix(downloads): file download honours the per-tab account (?account=)
A plain <a> file download can't send the X-Siftlode-Account header, so current_user resolved it to the session-default account — 404 'Unknown download' when the tab acts as a non-default wallet account that owns the file. resolved_user_id now also honours a ?account= query param (the same wallet-gated selection the WebSocket already uses), and downloadFileUrl appends the active account id. Verified: default account -> 404, ?account=<owner> -> 206 with the right Content-Disposition.
This commit is contained in:
parent
7d1ed24fea
commit
0045d41a74
2 changed files with 11 additions and 2 deletions
|
|
@ -1044,7 +1044,13 @@ export const api = {
|
|||
req(`/api/downloads/${id}/share`, { method: "POST", body: JSON.stringify({ email }) }),
|
||||
unshareDownload: (id: number, email: string) =>
|
||||
req(`/api/downloads/${id}/share/${encodeURIComponent(email)}`, { method: "DELETE" }),
|
||||
downloadFileUrl: (id: number): string => `/api/downloads/${id}/file`,
|
||||
// A plain <a> navigation can't send the X-Siftlode-Account header, so pass the active
|
||||
// account via ?account= (same wallet-gated selection the WebSocket uses) — otherwise the
|
||||
// download resolves to the session-default account and 404s for a per-tab account's file.
|
||||
downloadFileUrl: (id: number): string => {
|
||||
const a = getActiveAccount();
|
||||
return a != null ? `/api/downloads/${id}/file?account=${a}` : `/api/downloads/${id}/file`;
|
||||
},
|
||||
|
||||
// admin
|
||||
adminDownloads: (): Promise<DownloadJob[]> => req("/api/admin/downloads"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue