sftp: expand tilde and environment variables in configured known_hosts_file (#5322)

Fixes #5220
This commit is contained in:
albertony 2021-05-11 19:58:26 +02:00 committed by GitHub
parent 732bc08ced
commit ce83228cb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -566,7 +566,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
} }
if opt.KnownHostsFile != "" { if opt.KnownHostsFile != "" {
hostcallback, err := knownhosts.New(opt.KnownHostsFile) hostcallback, err := knownhosts.New(env.ShellExpand(opt.KnownHostsFile))
if err != nil { if err != nil {
return nil, errors.Wrap(err, "couldn't parse known_hosts_file") return nil, errors.Wrap(err, "couldn't parse known_hosts_file")
} }