Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrasimir Angelov <kangelov@gitlab.com>2019-12-19 01:41:20 +0300
committerKrasimir Angelov <kangelov@gitlab.com>2019-12-19 01:41:20 +0300
commitcb18db9be9033587d5961d4103b32a7b56a3a6d4 (patch)
treeed8bad8b624b810a5137e932ccbe0fc8ec4d82c0
parenta0fe1ec1de472439430679330b374e1cbe60652e (diff)
Ensure that publicPath always ends with "/"
-rw-r--r--internal/serving/disk/reader.go3
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 ..)