Skip to content

Commit 51c2bc7

Browse files
committed
HTML-escape title
1 parent 7deb775 commit 51c2bc7

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = 1.2.0
1+
VERSION = 1.2.1
22

33
APP := http-file-server
44
PACKAGES := $(shell go list -f {{.Dir}} ./...)

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ Or [download a binary](https://github.com/sgreben/http-file-server/releases/late
6060

6161
```sh
6262
# Linux
63-
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
63+
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
6464

6565
# OS X
66-
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
66+
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
6767

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

7373
## Use it

server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (f *fileHandler) serveDir(w http.ResponseWriter, r *http.Request, dirPath s
6969
w.Header().Set("Content-Type", "text/html; charset=utf-8")
7070
title, _ := filepath.Rel(f.path, dirPath)
7171
title = filepath.Join(filepath.Base(f.path), title)
72-
fmt.Fprintf(w, "<h1>%s</h1>\n", title)
72+
fmt.Fprintf(w, "<h1>%s</h1>\n", htmlReplacer.Replace(title))
7373
fmt.Fprintf(w, "<ul>\n")
7474
for _, d := range files {
7575
name := d.Name()

0 commit comments

Comments
 (0)