diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2021-04-08 09:06:49 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2021-04-13 04:14:16 +0300 |
commit | 34e1518038a8164c090ccfbfc30ebc7850e62cf0 (patch) | |
tree | 7cc8b5eb8c9b1c18eb106d7bd274f50a99d51f01 /internal/httpfs | |
parent | bda06683de6d93aeaff8d3c7357983ed7f0ccfc7 (diff) |
Allow serving zip from disk in chroot
This is a temporary workaround for https://gitlab.com/gitlab-org/gitlab/-/issues/326117#note_546346101
where daemon-inplace-chroot=true fails to serve zip archives when pages_serve_with_zip_file_protocol is enabled
To be removed after we roll-out zip architecture completely https://gitlab.com/gitlab-org/gitlab-pages/-/issues/561
Changelog: fixed
Diffstat (limited to 'internal/httpfs')
-rw-r--r-- | internal/httpfs/http_fs.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/httpfs/http_fs.go b/internal/httpfs/http_fs.go index cd2edb83..1ce90057 100644 --- a/internal/httpfs/http_fs.go +++ b/internal/httpfs/http_fs.go @@ -55,6 +55,13 @@ func (p *fileSystemPaths) Open(name string) (http.File, error) { return nil, err } for _, allowedPath := range p.allowedPaths { + // TODO: this is a temporary workaround for https://gitlab.com/gitlab-org/gitlab/-/issues/326117#note_546346101 + // where daemon-inplace-chroot=true fails to serve zip archives when pages_serve_with_zip_file_protocol is enabled + // To be removed after we roll-out zip architecture completely https://gitlab.com/gitlab-org/gitlab-pages/-/issues/561 + if allowedPath == "/" { + return os.Open(absPath) + } + if strings.HasPrefix(absPath, allowedPath+"/") { return os.Open(absPath) } |