Fix broken issue-body images in the panel drawer #43
No reviewers
Labels
No labels
bug
docs
enhancement
good first issue
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pedromcaraujo/forge!43
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/panel-issue-images"
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?
Fixes #42.
Images embedded in an issue body rendered as a broken-image icon (plus the linked alt-text) in the panel drawer.
Cause
Forgejo's
/api/v1/markdownAPI renders image attachments as root-relative HTML —<a href="/attachments/<uuid>"><img src="/attachments/<uuid>"></a>. The drawer injects that HTML, but it's served from the launcher origin, not Forgejo, so/attachments/…resolves against the launcher and 404s.Fix (
web/panel.py)_rewrite_urlspost-processes the rendered HTML:<img src>is routed through a new authenticated sidecar proxy, and<a href>links are absolutized to the Forgejo base. Protocol-relative and absolute URLs are left untouched./panel/<channel>/attachmentendpoint fetches the image from Forgejo with the API token and streams it back same-origin — so private-repo images load without relying on the browser holding a live Forgejo session./attachments/…or/<repo>/…), rejects//, absolute URLs and.., and caps the buffered size at 25 MB.No frontend or module change needed — the drawer already injects
body_htmland nginx already proxies the whole/panel/subtree to the sidecar.