Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

ftp: Fix for go1.6 and go1.7

Nick Craig-Wooda9101f8608e0
diff --git a/ftp/ftp.go b/ftp/ftp.go
index 05c8b126c..fae675b4d 100644
--- a/ftp/ftp.go
+++ b/ftp/ftp.go
@@ -134,10 +134,8 @@ func NewFs(name, root string) (ff fs.Fs, err error) {
fullPath = path.Join(u.Path, root)
}
root = fullPath
- dialAddr := u.Hostname()
- if u.Port() != "" {
- dialAddr += ":" + u.Port()
- } else {
+ dialAddr := u.Host
+ if strings.IndexRune(dialAddr, ':') < 0 {
dialAddr += ":21"
}
f := &Fs{