aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAron Fischer <github@aron.guru>2016-11-18 21:41:37 +0800
committerFelix Lange <fjl@twurst.com>2016-11-18 21:41:37 +0800
commit0d9a8207d60136024db4009aecbc91c7aab3042e (patch)
tree9fd0eb3e7c9ffb6fdf445c3aaf3e0d033277652a
parent04edbb0703142f792522e29a557069a3e52705f5 (diff)
downloaddexon-0d9a8207d60136024db4009aecbc91c7aab3042e.tar
dexon-0d9a8207d60136024db4009aecbc91c7aab3042e.tar.gz
dexon-0d9a8207d60136024db4009aecbc91c7aab3042e.tar.bz2
dexon-0d9a8207d60136024db4009aecbc91c7aab3042e.tar.lz
dexon-0d9a8207d60136024db4009aecbc91c7aab3042e.tar.xz
dexon-0d9a8207d60136024db4009aecbc91c7aab3042e.tar.zst
dexon-0d9a8207d60136024db4009aecbc91c7aab3042e.zip
cmd/bzzup: trim directory in the manifest entry path (#3299)
-rw-r--r--cmd/bzzup/main.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd/bzzup/main.go b/cmd/bzzup/main.go
index 83d6f9b7f..7d251aadb 100644
--- a/cmd/bzzup/main.go
+++ b/cmd/bzzup/main.go
@@ -106,7 +106,7 @@ func (c *client) uploadFile(file string, fi os.FileInfo) (manifest, error) {
func (c *client) uploadDirectory(dir string) (manifest, error) {
dirm := manifest{}
- prefix := filepath.ToSlash(dir) + "/"
+ prefix := filepath.ToSlash(filepath.Clean(dir)) + "/"
err := filepath.Walk(dir, func(path string, fi os.FileInfo, err error) error {
if err != nil || fi.IsDir() {
return err
@@ -115,7 +115,7 @@ func (c *client) uploadDirectory(dir string) (manifest, error) {
return fmt.Errorf("path %s outside directory %s", path, dir)
}
entry, err := c.uploadFile(path, fi)
- entry.Path = strings.TrimPrefix(filepath.ToSlash(path), prefix)
+ entry.Path = strings.TrimPrefix(filepath.ToSlash(filepath.Clean(path)), prefix)
dirm.Entries = append(dirm.Entries, entry)
return err
})