Render issue attachments in proportion and play video uploads - #293
Merged
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 setheight: 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 plainURLResponsecarries neither status norContent-Range. The loader now answers206with 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=4with its full duration.Release Notes: