Skip to content

Commit

Permalink
Convert spaces in the path only for now
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbertchen committed Jan 23, 2018
1 parent e0d7355 commit ffe04d6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/duplicacy_b2storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package duplicacy

import (
"strings"
"net/url"
)

type B2Storage struct {
Expand Down Expand Up @@ -211,7 +210,7 @@ func (storage *B2Storage) GetFileInfo(threadIndex int, filePath string) (exist b
// DownloadFile reads the file at 'filePath' into the chunk.
func (storage *B2Storage) DownloadFile(threadIndex int, filePath string, chunk *Chunk) (err error) {

filePath = url.PathEscape(filePath)
filePath = strings.Replace(filePath, " ", "%20", -1)
readCloser, _, err := storage.clients[threadIndex].DownloadFile(filePath)
if err != nil {
return err
Expand All @@ -225,7 +224,7 @@ func (storage *B2Storage) DownloadFile(threadIndex int, filePath string, chunk *

// UploadFile writes 'content' to the file at 'filePath'.
func (storage *B2Storage) UploadFile(threadIndex int, filePath string, content []byte) (err error) {
filePath = url.PathEscape(filePath)
filePath = strings.Replace(filePath, " ", "%20", -1)
return storage.clients[threadIndex].UploadFile(filePath, content, storage.UploadRateLimit/len(storage.clients))
}

Expand Down

0 comments on commit ffe04d6

Please sign in to comment.