Skip to content

Commit

Permalink
HTML-escape title
Browse files Browse the repository at this point in the history
  • Loading branch information
sgreben committed Nov 14, 2018
1 parent 7deb775 commit 51c2bc7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = 1.2.0
VERSION = 1.2.1

APP := http-file-server
PACKAGES := $(shell go list -f {{.Dir}} ./...)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ Or [download a binary](https://github.com/sgreben/http-file-server/releases/late

```sh
# Linux
curl -L https://github.com/sgreben/http-file-server/releases/download/1.2.0/http-file-server_1.2.0_linux_x86_64.tar.gz | tar xz
curl -L https://github.com/sgreben/http-file-server/releases/download/1.2.1/http-file-server_1.2.1_linux_x86_64.tar.gz | tar xz

# OS X
curl -L https://github.com/sgreben/http-file-server/releases/download/1.2.0/http-file-server_1.2.0_osx_x86_64.tar.gz | tar xz
curl -L https://github.com/sgreben/http-file-server/releases/download/1.2.1/http-file-server_1.2.1_osx_x86_64.tar.gz | tar xz

# Windows
curl -LO https://github.com/sgreben/http-file-server/releases/download/1.2.0/http-file-server_1.2.0_windows_x86_64.zip
unzip versions_1.2.0_windows_x86_64.zip
curl -LO https://github.com/sgreben/http-file-server/releases/download/1.2.1/http-file-server_1.2.1_windows_x86_64.zip
unzip versions_1.2.1_windows_x86_64.zip
```

## Use it
Expand Down
2 changes: 1 addition & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (f *fileHandler) serveDir(w http.ResponseWriter, r *http.Request, dirPath s
w.Header().Set("Content-Type", "text/html; charset=utf-8")
title, _ := filepath.Rel(f.path, dirPath)
title = filepath.Join(filepath.Base(f.path), title)
fmt.Fprintf(w, "<h1>%s</h1>\n", title)
fmt.Fprintf(w, "<h1>%s</h1>\n", htmlReplacer.Replace(title))
fmt.Fprintf(w, "<ul>\n")
for _, d := range files {
name := d.Name()
Expand Down

0 comments on commit 51c2bc7

Please sign in to comment.