diff --git a/common/download.go b/common/download.go index 110cb1536..5d3621d1c 100644 --- a/common/download.go +++ b/common/download.go @@ -637,6 +637,12 @@ func (d *SMBDownloader) toPath(base string, uri url.URL) (string, error) { } func (d *SMBDownloader) Download(dst *os.File, src *url.URL) error { + + /* first we warn the world if we're not running windows */ + if runtime.GOOS != "windows" { + return fmt.Errorf("Support for SMB based uri's are not supported on %s", runtime.GOOS) + } + d.active = false /* convert the uri using the net/url module to a UNC path */ diff --git a/common/download_test.go b/common/download_test.go index 114ca8ec3..a62fceb96 100644 --- a/common/download_test.go +++ b/common/download_test.go @@ -483,15 +483,19 @@ func TestFileUriTransforms(t *testing.T) { t.Logf("TestFileUriTransforms : Result Path '%s'", res) } - // ...and finally the oddball windows native path - // smb://host/sharename/file -> \\host\sharename\file - testcase := host + "/" + share + "/" + cwd[1:] + "/%s" - uri := "smb://" + fmt.Sprintf(testcase, testpath) - t.Logf("TestFileUriTransforms : Trying Uri '%s'", uri) - res, err := SimulateFileUriDownload(t, uri) - if err != nil { - t.Errorf("Unable to transform uri '%s' into a path", uri) - return + // smb protocol depends on platform support which currently + // only exists on windows. + if runtime.GOOS == "windows" { + // ...and finally the oddball windows native path + // smb://host/sharename/file -> \\host\sharename\file + testcase := host + "/" + share + "/" + cwd[1:] + "/%s" + uri := "smb://" + fmt.Sprintf(testcase, testpath) + t.Logf("TestFileUriTransforms : Trying Uri '%s'", uri) + res, err := SimulateFileUriDownload(t, uri) + if err != nil { + t.Errorf("Unable to transform uri '%s' into a path", uri) + return + } + t.Logf("TestFileUriTransforms : Result Path '%s'", res) } - t.Logf("TestFileUriTransforms : Result Path '%s'", res) }