Files
windmill/frontend/src/lib/components
Ruben FiszelandClaude Opus 4.7 07a4cb6872 branch download UI on shouldDownloadViaClient instead of onclick interception (#9118)
* fix(frontend): branch download UI on shouldDownloadViaClient instead of intercepting in onclick

When OpenAPI.TOKEN is set, several download links rendered an `<a href>`
to the API and relied on an `onclick` handler to call `e.preventDefault()`
and route the request through `downloadViaClient`. This is fragile in
embedded contexts (e.g. the whitelabel React SDK) where Svelte's hydrated
event listener may not intercept the click in time, so the browser
follows the unauthenticated `href` straight to the API.

Mirror the drawer pattern already used in `LogViewer` and
`FlowStatusViewerInner`: render a `<button>` calling `downloadViaClient`
when `shouldDownloadViaClient()` is true, and fall back to the plain
`<a href download>` otherwise. Affects the LogViewer top bar, the large-
result download in DisplayResult, the inline S3 link in ObjectViewer,
the CSV link in ParqetCsvTableRenderer, and FileDownload.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(frontend): treat custom HEADERS / basic auth as token equivalents in shouldDownloadViaClient

Customers wiring the SDK with cookie-bypass auth via custom request
headers (e.g. `OpenAPI.HEADERS = getAuthHeaders()` returning a Bearer
header) had `shouldDownloadViaClient()` return false because it only
checked `OpenAPI.TOKEN`. The plain `<a href download>` branch then
followed the link without those headers, so authenticated downloads
silently degraded to the cookie path (or failed when there is no cookie).

Widen the check to any non-cookie auth: TOKEN, HEADERS, or USERNAME
(basic auth). Route `downloadViaClient` through the generated client's
`getHeaders` so all configured auth schemes are applied consistently
instead of hand-building an Authorization header for TOKEN only.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 10:42:05 +00:00
..
2026-04-07 21:03:06 +00:00
2025-09-11 07:57:01 +00:00
2026-05-05 21:12:00 +00:00
2026-03-16 12:07:45 +00:00
2026-03-26 18:52:15 +00:00
2026-03-05 18:11:40 +01:00
2026-03-05 18:11:40 +01:00
2026-03-27 19:39:55 +00:00
2025-10-30 06:47:26 +00:00
2025-10-28 17:52:04 +00:00
2026-03-05 18:11:40 +01:00
2026-04-07 21:03:06 +00:00
2025-12-16 21:16:42 +00:00
2025-11-04 19:13:09 +00:00
2025-11-29 01:23:47 +00:00
2025-07-19 06:59:49 +00:00
2026-03-05 18:11:40 +01:00
2025-11-04 19:13:09 +00:00
2026-02-17 12:48:58 +00:00
2026-02-11 06:27:21 +00:00
2026-02-19 09:33:33 +00:00
2025-06-30 00:07:35 +00:00
2025-11-29 01:23:47 +00:00
2025-07-29 19:28:54 +00:00
2026-03-05 18:11:40 +01:00
2026-02-19 09:33:33 +00:00
2026-03-05 18:11:40 +01:00
2026-03-05 18:11:40 +01:00
2026-03-05 18:11:40 +01:00
2025-12-27 12:35:19 +00:00