diff options
author | Krasimir Angelov <kangelov@gitlab.com> | 2019-12-19 01:41:20 +0300 |
---|---|---|
committer | Krasimir Angelov <kangelov@gitlab.com> | 2019-12-19 01:41:20 +0300 |
commit | cb18db9be9033587d5961d4103b32a7b56a3a6d4 (patch) | |
tree | ed8bad8b624b810a5137e932ccbe0fc8ec4d82c0 | |
parent | a0fe1ec1de472439430679330b374e1cbe60652e (diff) |
Ensure that publicPath always ends with "/"
-rw-r--r-- | internal/serving/disk/reader.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/serving/disk/reader.go b/internal/serving/disk/reader.go index 533c6d4e..0bc72646 100644 --- a/internal/serving/disk/reader.go +++ b/internal/serving/disk/reader.go @@ -69,6 +69,9 @@ func (reader *Reader) tryNotFound(h serving.Handler) error { // Resolve the HTTP request to a path on disk, converting requests for // directories to requests for index.html inside the directory if appropriate. func (reader *Reader) resolvePath(publicPath string, subPath ...string) (string, error) { + // Ensure that publicPath always ends with "/" + publicPath = strings.TrimSuffix(publicPath, "/") + "/" + // Don't use filepath.Join as cleans the path, // where we want to traverse full path as supplied by user // (including ..) |