Modified common/download_test.go to not test the smb:// uri on platforms other than windows. Added an immediate platform error to SMBDownloader.Download as opposed to letting .toPath return it (which would have left the structure partially initialized).
This commit is contained in:
parent
4783b6508e
commit
5a4ce2165c
|
@ -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 */
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue