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:
authorVladimir Shushlin <vshushlin@gitlab.com>2020-10-21 11:52:51 +0300
committerVladimir Shushlin <vshushlin@gitlab.com>2020-10-21 11:52:51 +0300
commitb382faeec6491bb544d33549570610a476f597b7 (patch)
tree19c7185b558848057a4956053bc7dde72c018ef3
parent05c6facd72644095ca1aeff88c564dfb411fe34f (diff)
parent517dcf8dbf11a6b6abbc1365cc456b5fbfe6436b (diff)
Merge branch 'realFlowControl-master-patch-44819' into 'master'
#460 Upgrade go-mimedb to support new types including avif images See merge request gitlab-org/gitlab-pages!353
-rw-r--r--acceptance_test.go30
-rw-r--r--app.go3
-rw-r--r--go.mod2
-rw-r--r--go.sum4
4 files changed, 27 insertions, 12 deletions
diff --git a/acceptance_test.go b/acceptance_test.go
index 69ec8742..28dc7bd4 100644
--- a/acceptance_test.go
+++ b/acceptance_test.go
@@ -643,21 +643,35 @@ func TestPageNotAvailableIfNotLoaded(t *testing.T) {
require.Equal(t, http.StatusServiceUnavailable, rsp.StatusCode)
}
-func TestObscureMIMEType(t *testing.T) {
+func TestMIMETypes(t *testing.T) {
skipUnlessEnabled(t)
teardown := RunPagesProcessWithoutWait(t, *pagesBinary, listeners, "")
defer teardown()
require.NoError(t, httpListener.WaitUntilRequestSucceeds(nil))
- rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com", "project/file.webmanifest")
- require.NoError(t, err)
- defer rsp.Body.Close()
+ tests := map[string]struct {
+ file string
+ expectedContentType string
+ }{
+ "manifest_json": {
+ file: "file.webmanifest",
+ expectedContentType: "application/manifest+json",
+ },
+ }
- require.Equal(t, http.StatusOK, rsp.StatusCode)
- mt, _, err := mime.ParseMediaType(rsp.Header.Get("Content-Type"))
- require.NoError(t, err)
- require.Equal(t, "application/manifest+json", mt)
+ for name, tt := range tests {
+ t.Run(name, func(t *testing.T) {
+ rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com", "project/"+tt.file)
+ require.NoError(t, err)
+ defer rsp.Body.Close()
+
+ require.Equal(t, http.StatusOK, rsp.StatusCode)
+ mt, _, err := mime.ParseMediaType(rsp.Header.Get("Content-Type"))
+ require.NoError(t, err)
+ require.Equal(t, tt.expectedContentType, mt)
+ })
+ }
}
func TestCompressedEncoding(t *testing.T) {
diff --git a/app.go b/app.go
index 5a195396..aa95a917 100644
--- a/app.go
+++ b/app.go
@@ -12,10 +12,11 @@ import (
ghandlers "github.com/gorilla/handlers"
"github.com/rs/cors"
log "github.com/sirupsen/logrus"
+
+ "gitlab.com/gitlab-org/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"
diff --git a/go.mod b/go.mod
index 9e021ca5..a2cce75f 100644
--- a/go.mod
+++ b/go.mod
@@ -28,8 +28,8 @@ require (
github.com/tj/go-redirects v0.0.0-20180508180010-5c02ead0bbc5
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce
github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad
+ gitlab.com/gitlab-org/go-mimedb v1.45.0
gitlab.com/gitlab-org/labkit v0.0.0-20201014124351-eb1fe6499318
- gitlab.com/lupine/go-mimedb v0.0.0-20180307000149-e8af1d659877
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b
diff --git a/go.sum b/go.sum
index e9cf1de5..9c308626 100644
--- a/go.sum
+++ b/go.sum
@@ -344,8 +344,8 @@ github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZ
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
gitlab.com/gitlab-org/labkit v0.0.0-20201014124351-eb1fe6499318 h1:3xX/pl8dQjEtBZzHPCkex4Bwr7SGmVea/Zu4JdbZrKs=
gitlab.com/gitlab-org/labkit v0.0.0-20201014124351-eb1fe6499318/go.mod h1:SNfxkfUwVNECgtmluVayv0GWFgEjjBs5AzgsowPQuo0=
-gitlab.com/lupine/go-mimedb v0.0.0-20180307000149-e8af1d659877 h1:k5N2m0IPaMuwWmFTO9fyTK4IEnSm35GC/p1S7VRgUyM=
-gitlab.com/lupine/go-mimedb v0.0.0-20180307000149-e8af1d659877/go.mod h1:Es0wDVbtgNqhpEXMb+yct6JKnGMrNsUSh9oio0bqqdU=
+gitlab.com/gitlab-org/go-mimedb v1.45.0 h1:PO8dx6HEWzPYU6MQTYnCbpQEJzhJLW/Bh43+2VUHTgc=
+gitlab.com/gitlab-org/go-mimedb v1.45.0/go.mod h1:wa9y/zOSFKmTXLyBs4clz2FNVhZQmmEQM9TxslPAjZ0=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2 h1:75k/FF0Q2YM8QYo07VPddOLBslDt1MZOdEslOHvmzAs=