mirror of
https://github.com/rclone/rclone.git
synced 2024-11-28 11:25:18 +01:00
serve ftp: fix failed startup due to config changes
See: https://forum.rclone.org/t/failed-to-ftp-failed-to-parse-host-port/46959
This commit is contained in:
parent
30ba7542ff
commit
e111ffba9e
@ -150,17 +150,21 @@ type driver struct {
|
|||||||
userPass map[string]string // cache of username => password when using vfs proxy
|
userPass map[string]string // cache of username => password when using vfs proxy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
fs.RegisterGlobalOptions(fs.OptionsInfo{Name: "ftp", Opt: &Opt, Options: OptionsInfo})
|
||||||
|
}
|
||||||
|
|
||||||
var passivePortsRe = regexp.MustCompile(`^\s*\d+\s*-\s*\d+\s*$`)
|
var passivePortsRe = regexp.MustCompile(`^\s*\d+\s*-\s*\d+\s*$`)
|
||||||
|
|
||||||
// Make a new FTP to serve the remote
|
// Make a new FTP to serve the remote
|
||||||
func newServer(ctx context.Context, f fs.Fs, opt *Options) (*driver, error) {
|
func newServer(ctx context.Context, f fs.Fs, opt *Options) (*driver, error) {
|
||||||
host, port, err := net.SplitHostPort(opt.ListenAddr)
|
host, port, err := net.SplitHostPort(opt.ListenAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.New("failed to parse host:port")
|
return nil, fmt.Errorf("failed to parse host:port from %q", opt.ListenAddr)
|
||||||
}
|
}
|
||||||
portNum, err := strconv.Atoi(port)
|
portNum, err := strconv.Atoi(port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.New("failed to parse host:port")
|
return nil, fmt.Errorf("failed to parse port number from %q", port)
|
||||||
}
|
}
|
||||||
|
|
||||||
d := &driver{
|
d := &driver{
|
||||||
|
Loading…
Reference in New Issue
Block a user