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-18 08:17:35 +0300
committerJaime Martinez <jmartinez@gitlab.com>2020-09-22 03:26:27 +0300
commit1b018b63c65eb6ef54a39db1f0fa9194c45c4bae (patch)
tree5a322bb467f3fad0e3bd9ccc8d35e3cd64395a09 /internal/vfs
parent78a56d61856a6d499225dfabdfb3ff1d27eeb8d0 (diff)
Pass context to httprange Reader
Assert that if a context is canceled the read request will fail. Add missing ctx to zip
Diffstat (limited to 'internal/vfs')
-rw-r--r--internal/vfs/zip/archive.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/vfs/zip/archive.go b/internal/vfs/zip/archive.go
index a9265b08..ca9b778f 100644
--- a/internal/vfs/zip/archive.go
+++ b/internal/vfs/zip/archive.go
@@ -101,7 +101,7 @@ func (a *zipArchive) readArchive() {
// load all archive files into memory using a cached ranged reader
a.reader = httprange.NewRangedReader(a.resource)
- a.reader.WithCachedReader(func() {
+ a.reader.WithCachedReader(ctx, func() {
a.archive, a.err = zip.NewReader(a.reader, a.resource.Size)
})
@@ -149,7 +149,7 @@ func (a *zipArchive) Open(ctx context.Context, name string) (vfs.File, error) {
}
// only read from dataOffset up to the size of the compressed file
- reader := a.reader.SectionReader(dataOffset, int64(file.CompressedSize64))
+ reader := a.reader.SectionReader(ctx, dataOffset, int64(file.CompressedSize64))
switch file.Method {
case zip.Deflate: