Skip to content

[WE-168] Dependency rework #267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
repack paths to avoid glitches during unzip replace
  • Loading branch information
Roberto Sora committed Nov 27, 2018
commit df67daaa1484fd281272c48ceb4e3e523f050718
12 changes: 8 additions & 4 deletions tools/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func (t *Tools) Download(pack, name, version, behaviour string) error {
// Decompress

location := path.Join(dir(), pack, correctTool.Name, correctTool.Version)
t.Logger("Unpacking tool " + name + " in location: "+location)
t.Logger("Unpacking tool " + name + " in location: " + location)
err = os.RemoveAll(location)

if err != nil {
Expand Down Expand Up @@ -407,11 +407,15 @@ func extractZip(log func(msg string), body []byte, location string) (string, err
}

basedir := findBaseDir(dirList)
log(fmt.Sprintf("selected baseDir %s from Zip Archive Content: %v", basedir, dirList))
log(fmt.Sprintf("given location: %s > selected baseDir %s from Zip Archive Content: %v",location, basedir, dirList))

for _, f := range r.File {
fullname := filepath.Join(location, strings.Replace(filepath.ToSlash(f.Name), filepath.Clean(filepath.ToSlash(basedir)), "", -1))
log(fmt.Sprintf("selected fullname %s from replacing in %s the string %s", fullname, filepath.ToSlash(f.Name), filepath.Clean(filepath.ToSlash(basedir))))
normLocation := location
normName := filepath.Join(strings.Split(filepath.ToSlash(f.Name), "/")...)
normBaseDir := filepath.Join(strings.Split(filepath.ToSlash(basedir), "/")...)+ string(os.PathSeparator)
fullname := filepath.Join(normLocation, strings.Replace(normName, normBaseDir, "", -1))

log(fmt.Sprintf("selected fullname %s from replacing in %s the string %s", fullname, normName, normBaseDir))

if f.FileInfo().IsDir() {
os.MkdirAll(fullname, f.FileInfo().Mode().Perm())
Expand Down