Skip to content

Commit 0d9a820

Browse files
Aron Fischerfjl
authored andcommitted
cmd/bzzup: trim directory in the manifest entry path (#3299)
1 parent 04edbb0 commit 0d9a820

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/bzzup/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (c *client) uploadFile(file string, fi os.FileInfo) (manifest, error) {
106106

107107
func (c *client) uploadDirectory(dir string) (manifest, error) {
108108
dirm := manifest{}
109-
prefix := filepath.ToSlash(dir) + "/"
109+
prefix := filepath.ToSlash(filepath.Clean(dir)) + "/"
110110
err := filepath.Walk(dir, func(path string, fi os.FileInfo, err error) error {
111111
if err != nil || fi.IsDir() {
112112
return err
@@ -115,7 +115,7 @@ func (c *client) uploadDirectory(dir string) (manifest, error) {
115115
return fmt.Errorf("path %s outside directory %s", path, dir)
116116
}
117117
entry, err := c.uploadFile(path, fi)
118-
entry.Path = strings.TrimPrefix(filepath.ToSlash(path), prefix)
118+
entry.Path = strings.TrimPrefix(filepath.ToSlash(filepath.Clean(path)), prefix)
119119
dirm.Entries = append(dirm.Entries, entry)
120120
return err
121121
})

0 commit comments

Comments
 (0)