Commit e2c66710 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

common: style

parent a1668a73
...@@ -74,8 +74,8 @@ func DownloadableURL(original string) (string, error) { ...@@ -74,8 +74,8 @@ func DownloadableURL(original string) (string, error) {
} }
if url.Scheme == "file" { if url.Scheme == "file" {
// For Windows absolute file paths, remove leading / // For Windows absolute file paths, remove leading / prior to processing
// prior to processing // since net/url turns "C:/" into "/C:/"
if runtime.GOOS == "windows" && url.Path[0] == '/' { if runtime.GOOS == "windows" && url.Path[0] == '/' {
url.Path = url.Path[1:len(url.Path)] url.Path = url.Path[1:len(url.Path)]
} }
......
...@@ -107,12 +107,11 @@ func (d *DownloadClient) Get() (string, error) { ...@@ -107,12 +107,11 @@ func (d *DownloadClient) Get() (string, error) {
// Files when we don't copy the file are special cased. // Files when we don't copy the file are special cased.
var finalPath string var finalPath string
if url.Scheme == "file" && !d.config.CopyFile { if url.Scheme == "file" && !d.config.CopyFile {
// Remove forward slash on absolute Windows file URLs
// Before processing
if runtime.GOOS == "windows" && url.Path[0] == '/' {
finalPath = url.Path[1:len(url.Path)]
} else {
finalPath = url.Path finalPath = url.Path
// Remove forward slash on absolute Windows file URLs before processing
if runtime.GOOS == "windows" && finalPath[0] == '/' {
finalPath = finalPath[1:len(finalPath)]
} }
} else { } else {
finalPath = d.config.TargetPath finalPath = d.config.TargetPath
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment