Skip to content

Commit

Permalink
Fix listener path
Browse files Browse the repository at this point in the history
Make sure api root always has the "/" on the end of the path
  • Loading branch information
Ajnasz committed Oct 1, 2020
1 parent d898f9f commit 170b65b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/http"
"net/url"
"path"
"strings"
"time"

"github.com/Ajnasz/sekret.link/storage"
Expand Down Expand Up @@ -89,7 +90,13 @@ func main() {
apiRoot = webExternalURL.Path
}

apiRoot = path.Clean(apiRoot + "/")
apiRoot = path.Clean(apiRoot)

if !strings.HasSuffix(apiRoot, "/") {
apiRoot += "/"
}

log.Println("Handle Path: ", apiRoot)

http.Handle(apiRoot, http.StripPrefix(apiRoot, secretHandler{}))

Expand Down

0 comments on commit 170b65b

Please sign in to comment.