rgrove / rawgit

Served files from raw.githubusercontent.com, but with the correct content types. No longer actively developed.
https://rawgit.com
MIT License
2.39k stars 488 forks source link

Serve index.html for directory paths #72

Closed holic closed 9 years ago

holic commented 9 years ago

First off, thanks for rawgit! It's awesome. :sparkles:

We're using a CI to compile our static site, push to a staging branch, and preview it via rawgit. While most of our paths are relative, links to a directory path return a 400 and require adding index.html to the end of the URL.

See https://rawgit.com/iwantmyname/blog/97d7725/index.html vs. https://rawgit.com/iwantmyname/blog/97d7725/ (also try pagination at the bottom of each page)

Thoughts on rendering index.html for directories? Happy to open a PR for it if you think it fits the project :)

rgrove commented 9 years ago

:+1: Seems reasonable for RawGit to request index.html from GitHub if the requested URL doesn't include a filename.

If you want to open a PR, I'd probably recommend inspecting the request URL somewhere around here and rewriting it when it doesn't contain a filename. If you can't get to it, I'll add it to my todo list. :)

CheetahStream commented 9 years ago

Hi Rgrove, I am currently having issue with exactly this same problem for this URL - https://github.com/CheetahStream/XBMC/tree/master/_repo/ - Im really noob and not following how you guys were able to fix it and adding index.html to the end of my url doesnt work. Any direction you can point me in for some help on getting a working rawgit link to the root of my repo folder? Thanks

holic commented 9 years ago

@CheetahStream You need to have an index.html file in the directory you're trying to load. This simply checks for an index.html file for requests to the directory without a filename (i.e. /).