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:
Diffstat (limited to 'internal/httpfs/http_fs_test.go')
-rw-r--r--internal/httpfs/http_fs_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/httpfs/http_fs_test.go b/internal/httpfs/http_fs_test.go
index 7885dbf2..f47e17ff 100644
--- a/internal/httpfs/http_fs_test.go
+++ b/internal/httpfs/http_fs_test.go
@@ -65,6 +65,12 @@ func TestFSOpen(t *testing.T) {
expectedErrMsg: "no such file or directory",
chrootPath: wd + "/testdata",
},
+ "chroot_path_empty_finds_file": {
+ allowedPaths: []string{wd + "/testdata"},
+ fileName: wd + "/testdata/file1.txt",
+ expectedContent: "file1.txt\n",
+ chrootPath: "",
+ },
}
for name, test := range tests {
@@ -151,6 +157,13 @@ func TestFileSystemPathCanServeHTTP(t *testing.T) {
expectedStatusCode: http.StatusNotFound,
expectedContent: "404 page not found\n",
},
+ "chroot_path_empty_in_unit_test_file_found": {
+ path: wd + "/testdata",
+ fileName: "file1.txt",
+ chrootPath: "",
+ expectedStatusCode: http.StatusOK,
+ expectedContent: "file1.txt\n",
+ },
}
for name, test := range tests {