Commit
Author: Krystian ChachuĊ‚a [krystian@krystianch.com]
Committer: Drew DeVault [sir@cmpwn.com] Wed, 15 Dec 2021 17:04:00 +0000
Hash: 94c6289641ca95455c384691d699d885a7a16941
Timestamp: Wed, 15 Dec 2021 17:04:00 +0000 (3 years ago)

+1 -3 +/-1 browse
Fix handling of absolute staticDir paths
1diff --git a/main.go b/main.go
2index 1c08906..06d6ff5 100644
3--- a/main.go
4+++ b/main.go
5 @@ -10,7 +10,6 @@ import (
6 "net/http"
7 "net/url"
8 "os"
9- "path/filepath"
10 "sort"
11 "strconv"
12 "strings"
13 @@ -307,8 +306,7 @@ func main() {
14 }
15
16 router.Get("/*", func(w http.ResponseWriter, r *http.Request) {
17- workDir, _ := os.Getwd()
18- fs := http.FileServer(http.Dir(filepath.Join(workDir, staticDir)))
19+ fs := http.FileServer(http.Dir(staticDir))
20 fs.ServeHTTP(w, r)
21 })
22