Add download endpoint for documentation versions #65

Merged
qwc merged 1 commit from feature/download-version into main 2026-02-16 16:25:09 +01:00
Owner

Summary

  • Adds WriteZipFromDir function in internal/docs/archive.go that streams a directory as a ZIP archive
  • Adds GET /project/{slug}/version/{tag}/download endpoint with view-level access control (public projects allow anonymous download)
  • Adds "Download" button to the version list on project detail pages
  • Adds download icon (SVG) to the document overlay bar next to the version selector
  • Download handler tests in a separate download_test.go file

Closes #62

Test plan

  • go test ./internal/docs/... — unit tests for WriteZipFromDir (nested files, empty dir)
  • go test ./internal/handler/... — integration tests (success, public anonymous, private redirect, forbidden, 404 project/version)
  • go build — compiles cleanly
  • Manual: visit project detail page, confirm "Download" button next to each version
  • Manual: click Download, verify browser downloads a valid ZIP with correct content
  • Manual: view a doc page, confirm download icon in overlay bar
  • Manual: verify anonymous can download from public projects, gets redirected for private

🤖 Generated with Claude Code

## Summary - Adds `WriteZipFromDir` function in `internal/docs/archive.go` that streams a directory as a ZIP archive - Adds `GET /project/{slug}/version/{tag}/download` endpoint with view-level access control (public projects allow anonymous download) - Adds "Download" button to the version list on project detail pages - Adds download icon (SVG) to the document overlay bar next to the version selector - Download handler tests in a separate `download_test.go` file Closes #62 ## Test plan - [x] `go test ./internal/docs/...` — unit tests for `WriteZipFromDir` (nested files, empty dir) - [x] `go test ./internal/handler/...` — integration tests (success, public anonymous, private redirect, forbidden, 404 project/version) - [x] `go build` — compiles cleanly - [ ] Manual: visit project detail page, confirm "Download" button next to each version - [ ] Manual: click Download, verify browser downloads a valid ZIP with correct content - [ ] Manual: view a doc page, confirm download icon in overlay bar - [ ] Manual: verify anonymous can download from public projects, gets redirected for private 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Add download endpoint for documentation versions
All checks were successful
CI / test (pull_request) Successful in 1m5s
CI / build (pull_request) Successful in 49s
CI / docker (pull_request) Has been skipped
673189201f
Allows users to download extracted documentation as a ZIP archive.
Adds GET /project/{slug}/version/{tag}/download with view-level access
control, a download button on the version list page, and a download
icon in the document overlay bar.

Closes #62

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
qwc merged commit 6db04303cc into main 2026-02-16 16:25:09 +01:00
qwc deleted branch feature/download-version 2026-02-16 16:25:09 +01:00
Sign in to join this conversation.
No reviewers
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
qwc-open/asiakirjat!65
No description provided.