fix: PDF converter rejects HTML, auto-converts forge URLs to raw #81

Merged
mik-tf merged 1 commit from development_mik9 into development 2026-03-11 19:45:52 +00:00
Owner

Summary

  • Add to_raw_url() to convert forge /src/branch/ and GitHub /blob/ URLs to their raw content equivalents before fetching
  • Detect HTML responses (Content-Type or <!DOCTYPE) and return a clear error instead of generating a PDF of raw HTML source code
  • Forge file URLs now automatically work without users needing to know about /raw/ paths

Test plan

  • Forge web page URL (/mycelium/docs_mycelium) → rejected with clear error
  • Forge file URL (/src/branch/main/README.md) → auto-converted to raw → real PDF
  • Direct raw URLs still work as before
  • Generated PDF verified as valid %PDF-1.4

lhumina_code/home#21

## Summary - Add `to_raw_url()` to convert forge `/src/branch/` and GitHub `/blob/` URLs to their raw content equivalents before fetching - Detect HTML responses (Content-Type or `<!DOCTYPE`) and return a clear error instead of generating a PDF of raw HTML source code - Forge file URLs now automatically work without users needing to know about `/raw/` paths ## Test plan - [x] Forge web page URL (`/mycelium/docs_mycelium`) → rejected with clear error - [x] Forge file URL (`/src/branch/main/README.md`) → auto-converted to raw → real PDF - [x] Direct raw URLs still work as before - [x] Generated PDF verified as valid `%PDF-1.4` https://forge.ourworld.tf/lhumina_code/home/issues/21
fix: PDF converter rejects HTML responses, auto-converts forge URLs to raw
Some checks failed
Test / test (pull_request) Failing after 3s
Test / integration (pull_request) Has been skipped
449d9ed33a
- Add to_raw_url() to convert forge /src/branch/ and GitHub /blob/ URLs
  to their raw content equivalents before fetching
- Detect HTML responses (Content-Type or <!DOCTYPE) and return a clear
  error instead of generating a PDF of raw HTML source code
- Fixes issue where pasting a web page URL produced unreadable PDFs

lhumina_code/home#21

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mik-tf merged commit a06d0d71b4 into development 2026-03-11 19:45:52 +00:00
mik-tf deleted branch development_mik9 2026-03-11 19:45:52 +00:00
Sign in to join this conversation.
No reviewers
No labels
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
lhumina_code/hero_books!81
No description provided.