Skip to content

Render issue attachments in proportion and play video uploads - #293

Merged
jiweiyuan merged 1 commit into
mainfrom
fix/issue-attachment-rendering
Aug 12, 2026
Merged

Render issue attachments in proportion and play video uploads#293
jiweiyuan merged 1 commit into
mainfrom
fix/issue-attachment-rendering

Conversation

@jiweiyuan

Copy link
Copy Markdown
Collaborator

An image pasted into an issue rendered stretched vertically, and a video upload did not render at all.

GitHub writes the upload's pixel size onto the image tag (<img width="1328" height="1080">), and the detail page clamped only the width — the height stayed at the original, so every screenshot came out distorted. Both the issue detail and the Markdown reader now set height: auto.

Video needed three things: <video> on the sanitizer whitelist (it was escaping to visible text), the bare attachment link GitHub uses for a video upload turned into a player the way GitHub's own renderer does, and real HTTP framing in the asset loader — WebKit reads media in byte ranges, and a plain URLResponse carries neither status nor Content-Range. The loader now answers 206 with the requested slice and holds the asset being seeked, so a video costs one trip to GitHub instead of one per range.

Verified by rendering the real page for #272 in a WKWebView with the live asset handler: the screenshot comes back in proportion and the video element reaches readyState=4 with its full duration.

Release Notes:

  • Fixed images in issues and pull requests rendering stretched.
  • Video attachments in issues and pull requests now play in the pane.

GitHub writes the upload's pixel size onto the image tag it pastes into a body,
so a width clamped to the pane against a height still set to the original
stretched every screenshot vertically. Images and video now carry `height: auto`
in both the issue detail and the Markdown reader.

Video did not render at all. `<video>` was not on the sanitizer whitelist, so
raw player markup escaped to visible text; a video upload arrives as a bare
attachment link that only GitHub's own renderer turns into a player, so the pane
makes the same substitution; and playback through the token-authenticating
scheme handler needed real HTTP framing, since WebKit reads media in byte ranges
and a plain URLResponse carries neither status nor `Content-Range`. The handler
answers 206 with the requested slice and holds the asset being seeked, so a
video costs one trip to GitHub instead of one per range.
@vercel

vercel Bot commented Aug 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
landing Ready Ready Preview Aug 12, 2026 10:36pm

Request Review

@jiweiyuan
jiweiyuan merged commit 8f22435 into main Aug 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant