From e111ffba9e55baab86f6d0e9ec0b8cfe2d8871b4 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 21 Jul 2024 10:26:10 +0100 Subject: [PATCH] serve ftp: fix failed startup due to config changes See: https://forum.rclone.org/t/failed-to-ftp-failed-to-parse-host-port/46959 --- cmd/serve/ftp/ftp.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/serve/ftp/ftp.go b/cmd/serve/ftp/ftp.go index 5e864aaf8..ce50a2e03 100644 --- a/cmd/serve/ftp/ftp.go +++ b/cmd/serve/ftp/ftp.go @@ -150,17 +150,21 @@ type driver struct { 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*$`) // Make a new FTP to serve the remote func newServer(ctx context.Context, f fs.Fs, opt *Options) (*driver, error) { host, port, err := net.SplitHostPort(opt.ListenAddr) 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) 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{