mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
swarm/api/client: improve UploadDirectory default path handling
This commit is contained in:
parent
e3e5583ec5
commit
46df2b2ae0
1 changed files with 7 additions and 2 deletions
|
|
@ -175,9 +175,14 @@ func (c *Client) UploadDirectory(dir, defaultPath, manifest string, toEncrypt bo
|
||||||
} else if !stat.IsDir() {
|
} else if !stat.IsDir() {
|
||||||
return "", fmt.Errorf("not a directory: %s", dir)
|
return "", fmt.Errorf("not a directory: %s", dir)
|
||||||
}
|
}
|
||||||
|
if defaultPath != "" {
|
||||||
if _, err := os.Stat(filepath.Join(dir, defaultPath)); err != nil {
|
if _, err := os.Stat(filepath.Join(dir, defaultPath)); err != nil {
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
return "", fmt.Errorf("the default path %q was not found in the upload directory %q", defaultPath, dir)
|
||||||
|
}
|
||||||
return "", fmt.Errorf("default path: %v", err)
|
return "", fmt.Errorf("default path: %v", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return c.TarUpload(manifest, &DirectoryUploader{dir}, defaultPath, toEncrypt)
|
return c.TarUpload(manifest, &DirectoryUploader{dir}, defaultPath, toEncrypt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue