diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2020-02-18 15:13:32 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2020-02-18 15:13:32 +0300 |
commit | c7e283a96f8fe340304f399efc75ec2b62134dca (patch) | |
tree | 23977020c5ae0c774cae017a08597f4bd7bd7188 /internal/domain | |
parent | b859280bce9e347987e0878ae28aee8033954158 (diff) |
Ensure that we not do return nil serving.Request
Diffstat (limited to 'internal/domain')
-rw-r--r-- | internal/domain/domain.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/domain/domain.go b/internal/domain/domain.go index af238668..9ac668a5 100644 --- a/internal/domain/domain.go +++ b/internal/domain/domain.go @@ -8,6 +8,7 @@ import ( "gitlab.com/gitlab-org/gitlab-pages/internal/httperrors" "gitlab.com/gitlab-org/gitlab-pages/internal/serving" + "gitlab.com/gitlab-org/gitlab-pages/internal/serving/disk" ) // Domain is a domain that gitlab-pages can serve. @@ -37,9 +38,12 @@ func (d *Domain) isUnconfigured() bool { } func (d *Domain) resolve(r *http.Request) *serving.Request { - // Current implementation does not return errors in any case request, _ := d.Resolver.Resolve(r) + if request == nil { + return &serving.Request{Serving: disk.New()} + } + return request } @@ -52,7 +56,7 @@ func (d *Domain) GetLookupPath(r *http.Request) *serving.LookupPath { return nil } - return d.resolve(r).LookupPath + return request.LookupPath } // IsHTTPSOnly figures out if the request should be handled with HTTPS |