Skip to content

Commit

Permalink
Merge pull request #100 from replicatedhq/divolgin/registry-auth
Browse files Browse the repository at this point in the history
airgap upload fails when app files are in directories
  • Loading branch information
divolgin authored Oct 22, 2019
2 parents dbad187 + 11eea00 commit d378efb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ffi/airgap.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ func extractAppRelease(workspace string, airgapDir string) (string, error) {
}
err := extractOneArchive(filepath.Join(airgapDir, file.Name()), destDir)
if err != nil {
fmt.Printf("ignoring file %q\n", file.Name())
fmt.Printf("ignoring file %q: %v\n", file.Name(), err)
continue
}
numExtracted++
Expand Down Expand Up @@ -345,10 +345,18 @@ func extractOneArchive(tgzFile string, destDir string) error {

err = func() error {
fileName := filepath.Join(destDir, hdr.Name)

filePath, _ := filepath.Split(fileName)
err := os.MkdirAll(filePath, 0755)
if err != nil {
return errors.Wrapf(err, "failed to create directory %q", filePath)
}

fileWriter, err := os.Create(fileName)
if err != nil {
return errors.Wrapf(err, "failed to create file %q", hdr.Name)
}

defer fileWriter.Close()

_, err = io.Copy(fileWriter, tarReader)
Expand Down

0 comments on commit d378efb

Please sign in to comment.