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:
authorKamil Trzciński <ayufan@ayufan.eu>2019-03-01 13:28:30 +0300
committerKamil Trzciński <ayufan@ayufan.eu>2019-03-01 13:28:30 +0300
commitda03df956f659db8121991b330af26929a69cd2e (patch)
tree216eb3d5e41a4aa12d58cf4ef7d22dae03e99f98 /internal/storage
parent77a49c65a81a74a0ce78805900ee4fb6b3a17b34 (diff)
Open `.zip` archive
Diffstat (limited to 'internal/storage')
-rw-r--r--internal/storage/zip_storage.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/internal/storage/zip_storage.go b/internal/storage/zip_storage.go
index 75611f11..d658d8b1 100644
--- a/internal/storage/zip_storage.go
+++ b/internal/storage/zip_storage.go
@@ -11,7 +11,7 @@ import (
type zipStorage struct {
*client.LookupPath
- zipArchive *zip.ReadCloser
+ archive *zip.ReadCloser
}
func (z *zipStorage) Resolve(path string) (string, error) {
@@ -26,6 +26,15 @@ func (z *zipStorage) Open(path string) (File, os.FileInfo, error) {
return nil, nil, errors.New("not supported")
}
+func (z *zipStorage) Close() {
+ z.archive.Close()
+}
+
func newZipStorage(lookupPath *client.LookupPath) (S, error) {
- return nil, errors.New("not supported")
+ archive, err := zip.OpenReader(lookupPath.ArchivePath)
+ if err != nil {
+ return nil, err
+ }
+
+ return &zipStorage{LookupPath: lookupPath, archive: archive}, nil
}