Add PDF documentation upload support #72

Merged
qwc merged 9 commits from feature/pdf-upload-support into main 2026-02-20 07:34:51 +01:00
Owner

Summary

Implements PDF upload support as requested in #68.

  • Database: New migration (007) adds content_type column to versions table, defaulting to 'archive' for existing rows
  • Upload: Both web UI and API endpoints detect .pdf files by filename extension, store the PDF as document.pdf in the version directory instead of extracting an archive
  • Serving: PDF versions render in an HTML wrapper page with <embed> tag, preserving the overlay toolbar (version selector, search, navigation all work normally)
  • Download: PDF versions serve the raw PDF file directly instead of generating a ZIP
  • Version list: PDF versions show a red "PDF" badge and contextual download label
  • Search: PDF versions are silently skipped during Bleve indexing (no text extraction library yet)

Not in scope (deferred per #68)

  • Full-text search of PDF content
  • Diff comparison for PDF versions

Test plan

  • Upload a PDF via the web UI — verify it appears in version list with "PDF" badge
  • Click the PDF version link — verify PDF opens in browser with overlay toolbar
  • Upload an archive version to the same project — verify both types coexist
  • Download a PDF version — verify raw PDF is served (not zipped)
  • Re-upload a version changing type (archive → PDF or vice versa) — verify it works
  • Verify search doesn't crash (PDF versions silently skipped)
  • go test ./... passes

🤖 Generated with Claude Code

## Summary Implements PDF upload support as requested in #68. - **Database**: New migration (007) adds `content_type` column to `versions` table, defaulting to `'archive'` for existing rows - **Upload**: Both web UI and API endpoints detect `.pdf` files by filename extension, store the PDF as `document.pdf` in the version directory instead of extracting an archive - **Serving**: PDF versions render in an HTML wrapper page with `<embed>` tag, preserving the overlay toolbar (version selector, search, navigation all work normally) - **Download**: PDF versions serve the raw PDF file directly instead of generating a ZIP - **Version list**: PDF versions show a red "PDF" badge and contextual download label - **Search**: PDF versions are silently skipped during Bleve indexing (no text extraction library yet) ### Not in scope (deferred per #68) - Full-text search of PDF content - Diff comparison for PDF versions ## Test plan - [ ] Upload a PDF via the web UI — verify it appears in version list with "PDF" badge - [ ] Click the PDF version link — verify PDF opens in browser with overlay toolbar - [ ] Upload an archive version to the same project — verify both types coexist - [ ] Download a PDF version — verify raw PDF is served (not zipped) - [ ] Re-upload a version changing type (archive → PDF or vice versa) — verify it works - [ ] Verify search doesn't crash (PDF versions silently skipped) - [ ] `go test ./...` passes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Add PDF documentation upload support (#68)
All checks were successful
Release / test (push) Successful in 1m7s
CI / test (pull_request) Successful in 1m5s
CI / build (pull_request) Successful in 48s
CI / docker (pull_request) Has been skipped
Release / release (push) Successful in 1m26s
Release / docker (push) Successful in 1m26s
Release / notify (push) Successful in 1s
5143421496
Accept .pdf file uploads alongside archives. PDF versions are stored as
a single file and served in an HTML wrapper with the overlay toolbar.
Search indexing is skipped for PDF versions (no text extraction yet).

- Add content_type column to versions (migration 007)
- Detect PDF uploads in web and API handlers
- Serve PDF in embedded viewer with overlay
- Show PDF badge in version list, serve raw PDF on download
- Update upload form to accept .pdf files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract text from PDFs for Bleve search indexing using pdftotext
  (poppler-utils) with pure Go fallback (ledongthuc/pdf)
- Add poppler-utils to Docker runtime image for best extraction quality
- Re-enable search indexing for PDF uploads (was skipped in #68)
- Add content_type to versions API so overlay JS knows which are PDFs
- Block diff comparison for PDF versions with clear error message
  instead of confusing "Could not find content area" failure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merge pull request 'Add PDF full-text search and diff denial' (#73) from feature/pdf-search-and-diff-denial into feature/pdf-upload-support
All checks were successful
CI / test (pull_request) Successful in 1m6s
Release / test (push) Successful in 1m7s
CI / build (pull_request) Successful in 52s
Release / release (push) Successful in 1m22s
Release / docker (push) Successful in 1m30s
CI / docker (pull_request) Has been skipped
Release / notify (push) Successful in 1s
e5fdb8ca33
Reviewed-on: #73
Fix built-in documentation gaps and inaccuracies
All checks were successful
CI / build (pull_request) Successful in 40s
CI / docker (pull_request) Has been skipped
CI / test (pull_request) Successful in 56s
2026455ce9
- Fix config field names (host->address, user_base_dn->base_dn, storage default)
- Rewrite LDAP/OAuth2 config docs to match actual config.go fields
- Add PDF upload support documentation across all relevant pages
- Add retention, proxy_strip_path, log_level config documentation
- Fix editor role: can create projects (not just admin)
- Add 100 MB upload size limit (was incorrectly "no hard-coded limit")
- Add version diffing and PDF support to feature list

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
Owner

Added comprehensive built-in documentation fixes (commit 2026455):

  • Fixed config field names throughout (hostaddress, user_base_dnbase_dn, storage default data/docsdata/projects)
  • Rewrote LDAP and OAuth2 config docs to match actual config.go fields (removed non-existent fields like username_attr, provider, claims.*, nested tls:)
  • Added PDF upload support documentation across tutorials, reference, and explanation pages
  • Added retention, proxy_strip_path, log_level config documentation
  • Fixed editor role permissions: can create projects (not just admin)
  • Corrected upload size limit (100 MB, was "no hard-coded limit")
  • Added version diffing and PDF support to feature list on index page

11 files changed, 210 insertions, 135 deletions.

Added comprehensive built-in documentation fixes (commit 2026455): - Fixed config field names throughout (`host`→`address`, `user_base_dn`→`base_dn`, storage default `data/docs`→`data/projects`) - Rewrote LDAP and OAuth2 config docs to match actual `config.go` fields (removed non-existent fields like `username_attr`, `provider`, `claims.*`, nested `tls:`) - Added PDF upload support documentation across tutorials, reference, and explanation pages - Added retention, `proxy_strip_path`, `log_level` config documentation - Fixed editor role permissions: can create projects (not just admin) - Corrected upload size limit (100 MB, was "no hard-coded limit") - Added version diffing and PDF support to feature list on index page 11 files changed, 210 insertions, 135 deletions.
Merge remote-tracking branch 'origin/main' into feature/pdf-upload-support
All checks were successful
Release / docker (push) Successful in 1m13s
CI / docker (pull_request) Has been skipped
Release / notify (push) Successful in 1s
CI / test (pull_request) Successful in 56s
Release / test (push) Successful in 56s
CI / build (pull_request) Successful in 42s
Release / release (push) Successful in 1m7s
504da92101
# Conflicts:
#	internal/docs/builtin/docs/how-to/configure-ldap.md
#	internal/docs/builtin/docs/reference/configuration.md
The <embed> element is a replaced element that doesn't compute its
height from top+bottom constraints like block elements do. Set an
explicit height via calc(100vh - overlayHeight) and re-calculate on
window resize so the PDF always fills the space below the overlay.

Fixes #76

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merge pull request 'Fix PDF viewer only filling ~1/6 of viewport' (#78) from fix/pdf-viewer-height into feature/pdf-upload-support
Some checks failed
CI / build (pull_request) Blocked by required conditions
CI / docker (pull_request) Blocked by required conditions
CI / test (pull_request) Has been cancelled
a224a3f9e0
Reviewed-on: #78
Editors previously saw all projects in the admin panel regardless of
visibility. Now non-admin users only see projects they actually have
access to (public, private with global grant, or custom with explicit
access), using the same filtering logic as the frontpage.

When an editor creates a non-public project, they are automatically
granted editor-level access so they don't lose visibility of their
own project.

Fixes #77

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merge pull request 'Filter admin project list for editors, auto-grant on create' (#80) from fix/editor-project-list-filtering into feature/pdf-upload-support
All checks were successful
CI / test (pull_request) Successful in 56s
CI / build (pull_request) Successful in 44s
CI / docker (pull_request) Has been skipped
c518d24113
Reviewed-on: #80
qwc merged commit 1cfe281590 into main 2026-02-20 07:34:51 +01:00
qwc deleted branch feature/pdf-upload-support 2026-02-20 07:34:51 +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!72
No description provided.