common: allow files that don't exist to be URLs [GH-683]

This commit is contained in:
Mitchell Hashimoto 2013-12-06 18:31:45 -08:00
parent 2dad0cdca7
commit a380391b0e
2 changed files with 13 additions and 12 deletions

View File

@ -11,6 +11,7 @@ BUG FIXES:
* core: Don't change background color on CLI anymore, making things look
a tad nicer in some terminals.
* core: multiple ISO URLs works properly in all builders. [GH-683]
* builder/amazon/chroot: Block when obtaining file lock to allow
parallel builds. [GH-689]
* builder/vmware: Cleanup of VMX keys works properly so cd-rom won't

View File

@ -105,21 +105,21 @@ func DownloadableURL(original string) (string, error) {
url.Path = strings.Replace(url.Path, `\`, `/`, -1)
}
if _, err := os.Stat(url.Path); err != nil {
return "", err
}
// Only do the filepath transformations if the file appears
// to actually exist.
if _, err := os.Stat(url.Path); err == nil {
url.Path, err = filepath.Abs(url.Path)
if err != nil {
return "", err
}
url.Path, err = filepath.Abs(url.Path)
if err != nil {
return "", err
}
url.Path, err = filepath.EvalSymlinks(url.Path)
if err != nil {
return "", err
}
url.Path, err = filepath.EvalSymlinks(url.Path)
if err != nil {
return "", err
url.Path = filepath.Clean(url.Path)
}
url.Path = filepath.Clean(url.Path)
}
// Make sure it is lowercased