Skip to content

Latest commit

 

History

History
51 lines (41 loc) · 2.39 KB

File metadata and controls

51 lines (41 loc) · 2.39 KB

Technical Notes

GitHub /raw And Git LFS

Observed on June 7, 2026:

  • raw.githubusercontent.com/... returns normal Git objects directly.
  • For Git LFS files, raw.githubusercontent.com/... returns the small text pointer rather than the stored object.
  • github.com/{owner}/{repo}/raw/{ref}/{path} returns 302:
    • Normal Git objects redirect to raw.githubusercontent.com.
    • Git LFS objects redirect to media.githubusercontent.com.
  • Ranged requests survive both redirect chains. A request for Range: bytes=0-15 produced a final 206 Partial Content response with the expected Content-Range and 16-byte body.
  • Both final content hosts advertise Access-Control-Allow-Origin: * and Accept-Ranges: bytes.
  • The initial github.com/.../raw/... redirect does not provide usable CORS headers. Browser fetch(..., { mode: "cors" }) fails before following the redirect for both normal and LFS files.

The service worker must fetch and rewrap content to preserve the preview origin, relative paths, MIME correction, and runtime requests. It therefore cannot replace its raw.githubusercontent.com fetch with the GitHub /raw resolver. Git LFS support is intentionally deferred.

Gist Support

Observed on July 4, 2026:

  • Raw Gist URLs use https://gist.githubusercontent.com/{user}/{gistId}/raw/{revision?}/{file}.
  • gist.github.com/{user}/{gistId}/raw/... redirects to the matching gist.githubusercontent.com/... URL.
  • gist.githubusercontent.com can be fetched directly from GitHub Pages. It returns CORS-compatible raw responses with Access-Control-Allow-Origin: *, Accept-Ranges: bytes, and Content-Type: text/plain.
  • Multi-file gists can use sibling relative paths such as ./style.css and ./index.js if the preview route preserves the shared raw prefix.

Final decision: do not support Gist for now.

Gist support is technically feasible for raw Gist URLs, but it is a marginal use case for this project. The current app is centered on GitHub repository files with an owner/repo/ref/path model. Gists use a separate owner/gistId/revision?/file model, have no normal directory tree, and bare Gist page URLs identify a file collection rather than a single preview target.

Adding Gist cleanly would require a parallel link parser and service-worker route namespace rather than extending the existing repository model. That complexity is not justified by the expected value.