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 'domain.go')
-rw-r--r--domain.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/domain.go b/domain.go
index 8af0e394..4b974806 100644
--- a/domain.go
+++ b/domain.go
@@ -35,8 +35,7 @@ func acceptsGZip(r *http.Request) bool {
func (d *domain) serveFile(w http.ResponseWriter, r *http.Request, fullPath string) error {
// Open and serve content of file
if acceptsGZip(r) {
- _, err := os.Stat(fullPath + ".gz")
- if err == nil {
+ if fi, err := os.Lstat(fullPath + ".gz"); err == nil && fi.Mode().IsRegular() {
// Set the content type based on the non-gzipped extension
_, haveType := w.Header()["Content-Type"]
if !haveType {
@@ -70,8 +69,7 @@ func (d *domain) serveCustomFile(w http.ResponseWriter, r *http.Request, code in
// Open and serve content of file
ext := filepath.Ext(fullPath)
if acceptsGZip(r) {
- _, err := os.Stat(fullPath + ".gz")
- if err == nil {
+ if fi, err := os.Lstat(fullPath + ".gz"); err == nil && fi.Mode().IsRegular() {
// Serve up the gzipped version
fullPath += ".gz"
w.Header().Set("Content-Encoding", "gzip")