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:
authorJaime Martinez <jmartinez@gitlab.com>2020-09-21 06:48:54 +0300
committerVladimir Shushlin <v.shushlin@gmail.com>2020-09-21 13:53:18 +0300
commite2998d393d7940153588266b2e8a8596f4def02c (patch)
tree00ea8221983547c56cdaaee63b13e4b3e4739a2e /internal/serving
parent2b9ccbc12eb270cab09811695c0c3721ba8e20b3 (diff)
Apply suggestions from feedback
Diffstat (limited to 'internal/serving')
-rw-r--r--internal/serving/disk/reader.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/serving/disk/reader.go b/internal/serving/disk/reader.go
index a0c0ed0d..caaccdc3 100644
--- a/internal/serving/disk/reader.go
+++ b/internal/serving/disk/reader.go
@@ -11,6 +11,7 @@ import (
"time"
"github.com/prometheus/client_golang/prometheus"
+ log "github.com/sirupsen/logrus"
"gitlab.com/gitlab-org/gitlab-pages/internal/redirects"
"gitlab.com/gitlab-org/gitlab-pages/internal/serving"
@@ -198,10 +199,12 @@ func (reader *Reader) serveFile(ctx context.Context, w http.ResponseWriter, r *h
reader.fileSizeMetric.Observe(float64(fi.Size()))
- // Support SeekableFile if available
+ // This is just a failsafe as we need to assert that file is of type
+ // vfs.SeekableFile before passing onto http.ServeContent
if rs, ok := file.(vfs.SeekableFile); ok {
http.ServeContent(w, r, origPath, fi.ModTime(), rs)
} else {
+ log.WithField("filename", fi.Name()).Traceln("file is not seekable")
w.Header().Set("Content-Length", strconv.FormatInt(fi.Size(), 10))
io.Copy(w, file)
}