Skip to content

Commit

Permalink
Merge pull request #9 from inabyte/prepend_slash
Browse files Browse the repository at this point in the history
Add / to beginning of filename
  • Loading branch information
MylesCagney committed Mar 8, 2020
2 parents e148932 + b51d524 commit 9ed1058
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions embedded/fs.go
Expand Up @@ -102,6 +102,7 @@ func New(count int) FileSystem {
}

func (fs *files) Open(name string) (file http.File, err error) {
name = path.Clean("/" + name)
if f, ok := fs.list[name]; ok {
if fs.local && len(f.local) > 0 {
file, err = os.Open(f.local)
Expand Down
6 changes: 6 additions & 0 deletions embedded/fs_test.go
Expand Up @@ -200,6 +200,12 @@ func TestFiles(t *testing.T) {
expect: indexBytes,
compressed: true,
},
{
name: "index no path",
file: "index.html",
expect: indexBytes,
compressed: true,
},
{
name: "settings",
file: "/settings.html",
Expand Down

0 comments on commit 9ed1058

Please sign in to comment.