From b1ed892ec69d3d15522153c8e0192fe00cf2e601 Mon Sep 17 00:00:00 2001 From: Nick Miyake Date: Mon, 10 Dec 2018 11:26:10 -0800 Subject: [PATCH] Update Gopkg.toml constraint for mholt/archiver (#2) Use concrete version rather than a branch now that a version with the required change exists. --- Gopkg.lock | 6 ++-- Gopkg.toml | 4 +-- vendor/github.com/mholt/archiver/README.md | 27 ++++++++++++++++++ vendor/github.com/mholt/archiver/appveyor.yml | 4 +-- vendor/github.com/mholt/archiver/archiver.go | 2 +- vendor/github.com/mholt/archiver/rar.go | 28 +++++++++++-------- vendor/github.com/mholt/archiver/tar.go | 2 +- 7 files changed, 51 insertions(+), 22 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 61a9ed40..62311c4f 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -81,12 +81,12 @@ version = "v0.0.2" [[projects]] - branch = "master" - digest = "1:4f17855b701d15f25e282fe70d432ecb023c9f115c79b211a06845e50dce7c48" + digest = "1:d6f988e7296cebe16d9c405b73bee34da871b382f7438c811279614a725239ae" name = "github.com/mholt/archiver" packages = ["."] pruneopts = "UT" - revision = "85d3d0b511eae05958ddb34e9eac57d8ffea03bf" + revision = "de0d89e255e17c8d75a40122055763e743ab0593" + version = "v2.1.0" [[projects]] branch = "develop" diff --git a/Gopkg.toml b/Gopkg.toml index f2460fe8..3b43b489 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -29,11 +29,9 @@ name = "github.com/go-bindata/go-bindata" version = "1.0.0" -# Need first release after 2.0 for "Read" function, but no such release exists yet. -# Once the next release is available, update this constraint to that version. [[constraint]] name = "github.com/mholt/archiver" - branch = "master" + version = "2.1.0" [[constraint]] name = "github.com/pkg/errors" diff --git a/vendor/github.com/mholt/archiver/README.md b/vendor/github.com/mholt/archiver/README.md index 33d0a3ee..f2d94f00 100644 --- a/vendor/github.com/mholt/archiver/README.md +++ b/vendor/github.com/mholt/archiver/README.md @@ -81,3 +81,30 @@ No. This works just like your OS would make an archive in the file explorer: org #### Can it add files to an existing archive? Nope. This is a simple tool; it just makes new archives or extracts existing ones. + + +## Project Values + +This project has a few principle-based goals that guide its development: + +- **Do one thing really well.** That is creating and opening archive files. It is not meant to be a replacement for specific archive format tools like tar, zip, etc. that have lots of features and customizability. (Some customizability is OK, but not to the extent that it becomes complicated or error-prone.) + +- **Have good tests.** Changes should be covered by tests. + +- **Limit dependencies.** Keep the package lightweight. + +- **Pure Go.** This means no cgo or other external/system dependencies. This package should be able to stand on its own and cross-compile easily to any platform. + +- **Idiomatic Go.** Keep interfaces small, variable names semantic, vet shows no errors, the linter is generally quiet, etc. + +- **Be elegant.** This package should be elegant to use and its code should be elegant when reading and testing. If it doesn't feel good, fix it up. + +- **Well-documented.** Use comments prudently; explain why non-obvious code is necessary (and use tests to enforce it). Keep the docs updated, and have examples where helpful. + +- **Keep it efficient.** This often means keep it simple. Fast code is valuable. + +- **Consensus.** Contributions should ideally be approved by multiple reviewers before being merged. Generally, avoid merging multi-chunk changes that do not go through at least one or two iterations/reviews. Except for trivial changes, PRs are seldom ready to merge right away. + +- **Have fun contributing.** Coding is awesome! + +We welcome contributions and appreciate your efforts! However, please open issues to discuss any changes before spending the time preparing a pull request. This will save time, reduce frustration, and help coordinate the work. Thank you! diff --git a/vendor/github.com/mholt/archiver/appveyor.yml b/vendor/github.com/mholt/archiver/appveyor.yml index f8f804f9..b970efdd 100644 --- a/vendor/github.com/mholt/archiver/appveyor.yml +++ b/vendor/github.com/mholt/archiver/appveyor.yml @@ -10,8 +10,8 @@ environment: install: - rmdir c:\go /s /q - - appveyor DownloadFile https://storage.googleapis.com/golang/go1.7.1.windows-amd64.zip - - 7z x go1.7.1.windows-amd64.zip -y -oC:\ > NUL + - appveyor DownloadFile https://dl.google.com/go/go1.10.4.windows-amd64.zip + - 7z x go1.10.4.windows-amd64.zip -y -oC:\ > NUL - go version - go env - go get -t ./... diff --git a/vendor/github.com/mholt/archiver/archiver.go b/vendor/github.com/mholt/archiver/archiver.go index 32baf3e0..6bf20162 100644 --- a/vendor/github.com/mholt/archiver/archiver.go +++ b/vendor/github.com/mholt/archiver/archiver.go @@ -112,7 +112,7 @@ func sanitizeExtractPath(filePath string, destination string) error { // the target path, and make sure it's nested in the intended // destination, or bail otherwise. destpath := filepath.Join(destination, filePath) - if !strings.HasPrefix(destpath, destination) { + if !strings.HasPrefix(destpath, filepath.Clean(destination)) { return fmt.Errorf("%s: illegal file path", filePath) } return nil diff --git a/vendor/github.com/mholt/archiver/rar.go b/vendor/github.com/mholt/archiver/rar.go index 86f8a63d..3ff61da6 100644 --- a/vendor/github.com/mholt/archiver/rar.go +++ b/vendor/github.com/mholt/archiver/rar.go @@ -64,6 +64,22 @@ func (rarFormat) Read(input io.Reader, destination string) error { return fmt.Errorf("read: failed to create reader: %v", err) } + return extract(rr, destination) +} + +// Open extracts the RAR file at source and puts the contents +// into destination. +func (rarFormat) Open(source, destination string) error { + rf, err := rardecode.OpenReader(source, "") + if err != nil { + return fmt.Errorf("%s: failed to open file: %v", source, err) + } + defer rf.Close() + + return extract(&rf.Reader, destination) +} + +func extract(rr *rardecode.Reader, destination string) error { for { header, err := rr.Next() if err == io.EOF { @@ -102,15 +118,3 @@ func (rarFormat) Read(input io.Reader, destination string) error { return nil } - -// Open extracts the RAR file at source and puts the contents -// into destination. -func (rarFormat) Open(source, destination string) error { - rf, err := os.Open(source) - if err != nil { - return fmt.Errorf("%s: failed to open file: %v", source, err) - } - defer rf.Close() - - return Rar.Read(rf, destination) -} diff --git a/vendor/github.com/mholt/archiver/tar.go b/vendor/github.com/mholt/archiver/tar.go index b2ffba8e..ee0c4436 100644 --- a/vendor/github.com/mholt/archiver/tar.go +++ b/vendor/github.com/mholt/archiver/tar.go @@ -146,7 +146,7 @@ func tarFile(tarWriter *tar.Writer, source, dest string) error { } if baseDir != "" { - header.Name = filepath.Join(baseDir, strings.TrimPrefix(path, source)) + header.Name = filepath.ToSlash(filepath.Join(baseDir, strings.TrimPrefix(path, source))) } if header.Name == dest {