fix double slash conundrum

This commit is contained in:
Megan Marsh 2019-07-19 10:16:40 -07:00
parent 975ee377b2
commit 64f16474f8
1 changed files with 9 additions and 1 deletions

View File

@ -171,12 +171,20 @@ func (s *StepDownload) download(ctx context.Context, ui packer.Ui, source string
// could guess it only in cases it is
// necessary.
}
src := u.String()
if u.Scheme == "" || strings.ToLower(u.Scheme) == "file" {
// If a local filepath, then we need to preprocess to make sure the
// path doens't have any multiple successive path separators; if it
// does, go-getter will read this as a specialized go-getter-specific
// subdirectory command, which it most likely isn't.
src = filepath.Clean(u.String())
}
ui.Say(fmt.Sprintf("Trying %s", u.String()))
gc := getter.Client{
Ctx: ctx,
Dst: targetPath,
Src: u.String(),
Src: src,
ProgressListener: ui,
Pwd: wd,
Dir: false,