fix(attachment): download file bytes, not the YouTrack SPA #70
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/attachment-get-spa-html-YT-24"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
yt issue attachment getwrote the YouTrack web SPA shell (the managerindex.html) to the output path instead of the attachment bytes. The attachmenturlfield is a root-relative path that, on instances served under a context path (e.g.https://host/youtrack), already carries that context. The old code concatenated it onto the configured base URL, duplicating the context (/youtrack/youtrack/...); that path matches no API route, so YouTrack returns its SPA shell with HTTP 200 and the body was saved verbatim.Resolve attachment URLs against the instance origin via
resolve_youtrack_url: absolute URLs pass through, root-relative paths that already include the context join to the origin (no duplication), and context-relative paths get the context prepended. The transport now also surfaces the responseContent-Type, anddownload_attachmentrejects any HTML response (by content type, or by an HTML body marker when no type is sent) rather than writing the app shell to disk.Tests: unit coverage for URL resolution across context/no-context/absolute/trailing-slash cases and the HTML heuristic, an add-then-get round-trip asserting byte equality (size + sha256), and a guard test that an SPA
text/htmlresponse fails loudly.#YT-24