Commit 243bdbc4 authored by Nick Thomas's avatar Nick Thomas 💃

Merge branch 'pages-gz-symlink-0.5.1' into 'master'

Don't serve statically-compiled `.gz` files that are symlinks (v0.5.1)

See merge request gitlab/gitlab-pages!1
parents 0173d4e6 fd3aa137
Pipeline #11563166 passed with stage
in 1 minute and 11 seconds
v 0.5.1
- Don't serve statically-compiled `.gz` files that are symlinks
v 0.5.0
- Don't try to update domains if reading the update file fails !32
- Add CORS support to GET requests !33
......
......@@ -41,8 +41,8 @@ func handleGZip(w http.ResponseWriter, r *http.Request, fullPath string) string
gzipPath := fullPath + ".gz"
_, err := os.Stat(gzipPath)
if err != nil {
// Ensure the .gz file is not a symlink
if fi, err := os.Lstat(gzipPath); err != nil || !fi.Mode().IsRegular() {
return fullPath
}
......
......@@ -122,6 +122,8 @@ func TestGroupServeHTTPGzip(t *testing.T) {
{"GET", "http://group.test.io/", nil, ";; gzip", "main-dir", false},
{"GET", "http://group.test.io/", nil, "middle-out", "main-dir", false},
{"GET", "http://group.test.io/", nil, "gzip; quality=1", "main-dir", false},
// Symlinked .gz files are not supported
{"GET", "http://group.test.io/gz-symlink", nil, "*", "data", false},
}
for _, tt := range testSet {
......
../config.json
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment