diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2020-09-28 06:23:32 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2020-09-28 06:23:32 +0300 |
commit | 946971d7e84e66570a5eb3f7e9a2a86bfc53e650 (patch) | |
tree | 898c138e44d9ae4404d41abe986bcf21ed63e792 | |
parent | 3af55d35c5cc6457eb658ee8b9a79267c2c85eeb (diff) |
remove non functional linetesting-avif-failures
-rw-r--r-- | app.go | 4 | ||||
-rw-r--r-- | extra_mime_types.go | 3 | ||||
-rw-r--r-- | internal/serving/disk/serving.go | 21 | ||||
-rw-r--r-- | main.go | 3 |
4 files changed, 5 insertions, 26 deletions
@@ -12,10 +12,11 @@ import ( ghandlers "github.com/gorilla/handlers" "github.com/rs/cors" log "github.com/sirupsen/logrus" + "gitlab.com/lupine/go-mimedb" + "gitlab.com/gitlab-org/labkit/errortracking" labmetrics "gitlab.com/gitlab-org/labkit/metrics" "gitlab.com/gitlab-org/labkit/monitoring" - "gitlab.com/lupine/go-mimedb" "gitlab.com/gitlab-org/gitlab-pages/internal/acme" "gitlab.com/gitlab-org/gitlab-pages/internal/artifact" @@ -475,6 +476,7 @@ func runApp(config appConfig) { log.WithError(err).Warn("Loading extended MIME database failed") } + addExtraMIMETypes() a.Run() } diff --git a/extra_mime_types.go b/extra_mime_types.go index c679c6a4..e89ef944 100644 --- a/extra_mime_types.go +++ b/extra_mime_types.go @@ -12,8 +12,7 @@ var extraMIMETypes = map[string]string{ } func addExtraMIMETypes() { - return - fmt.Printf("calling addExtraMIMETypes: %+v\n", extraMIMETypes) + fmt.Printf("calling addExtraMIMETypes: %+v\n", extraMIMETypes) for ext, mimeType := range extraMIMETypes { if err := mime.AddExtensionType(ext, mimeType); err != nil { fmt.Printf("failed %q - %+v\n", mimeType, err) diff --git a/internal/serving/disk/serving.go b/internal/serving/disk/serving.go index 8098f6f5..bb9b40d2 100644 --- a/internal/serving/disk/serving.go +++ b/internal/serving/disk/serving.go @@ -1,12 +1,8 @@ package disk import ( - "fmt" - "mime" "os" - "gitlab.com/gitlab-org/labkit/log" - "gitlab.com/gitlab-org/gitlab-pages/internal/httperrors" "gitlab.com/gitlab-org/gitlab-pages/internal/serving" "gitlab.com/gitlab-org/gitlab-pages/internal/vfs" @@ -47,7 +43,6 @@ func (s *Disk) ServeNotFoundHTTP(h serving.Handler) { // New returns a serving instance that is capable of reading files // from the VFS func New(vfs vfs.VFS) serving.Serving { - addExtraMIMETypes() return &Disk{ reader: Reader{ fileSizeMetric: metrics.DiskServingFileSize, @@ -55,19 +50,3 @@ func New(vfs vfs.VFS) serving.Serving { }, } } - -var extraMIMETypes = map[string]string{ - ".avif": "image/avif", -} - -func addExtraMIMETypes() { - fmt.Printf("calling addExtraMIMETypes: %+v\n", extraMIMETypes) - for ext, mimeType := range extraMIMETypes { - if err := mime.AddExtensionType(ext, mimeType); err != nil { - fmt.Printf("failed %q - %+v\n", mimeType, err) - log.WithError(err).Errorf("failed to add extension: %q with MIME type: %q", ext, mimeType) - } else { - fmt.Printf("loaded %q successfully\n", mimeType) - } - } -} @@ -13,6 +13,7 @@ import ( "github.com/namsral/flag" log "github.com/sirupsen/logrus" + "gitlab.com/gitlab-org/labkit/errortracking" "gitlab.com/gitlab-org/gitlab-pages/internal/logging" @@ -319,8 +320,6 @@ func appMain() { }).Print("GitLab Pages Daemon") log.Printf("URL: https://gitlab.com/gitlab-org/gitlab-pages") - addExtraMIMETypes() - if err := os.Chdir(*pagesRoot); err != nil { fatal(err, "could not change directory into pagesRoot") } |