Skip to content

Commit

Permalink
Quoting fixes on recursive deletes during upload sync.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin committed Oct 7, 2012
1 parent 91f83af commit 2853d27
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cbfsclient/rm.go
Expand Up @@ -51,7 +51,7 @@ func rmFile(u string) error {
res.Body.Close()
if res.StatusCode != 204 && res.StatusCode != 404 {
return fmt.Errorf("Unexpected status deleting %v: %v",
u, err)
u, res.Status)
}
return nil
}
Expand Down
5 changes: 3 additions & 2 deletions cbfsclient/upload.go
Expand Up @@ -212,6 +212,7 @@ func uploadFile(src, dest, localHash string) error {
// This is very similar to rm's version, but uses different channel
// signaling.
func uploadRmDashR(baseUrl string, ch chan uploadReq) ([]string, error) {
r := quotingReplacer
for strings.HasSuffix(baseUrl, "/") {
baseUrl = baseUrl[:len(baseUrl)-1]
}
Expand All @@ -221,14 +222,14 @@ func uploadRmDashR(baseUrl string, ch chan uploadReq) ([]string, error) {
return []string{}, err
}
for fn := range listing.Files {
err = rmFile(baseUrl + "/" + fn)
err = rmFile(baseUrl + "/" + r.Replace(fn))
if err != nil {
return []string{}, err
}
}
children := make([]string, 0, len(listing.Dirs))
for dn := range listing.Dirs {
children = append(children, baseUrl+"/"+dn)
children = append(children, baseUrl+"/"+r.Replace(dn))
}
return children, nil
}
Expand Down

0 comments on commit 2853d27

Please sign in to comment.