sftpfs: fix fingerprints copy for memory provider

This commit is contained in:
Nicola Murino 2020-12-12 10:56:02 +01:00
parent a6985075b9
commit 72e3d464b8
No known key found for this signature in database
GPG key ID: 2F1FB59433D5A8CB

View file

@ -881,7 +881,10 @@ func (u *User) getACopy() User {
Prefix: u.FsConfig.SFTPConfig.Prefix,
},
}
copy(fsConfig.SFTPConfig.Fingerprints, u.FsConfig.SFTPConfig.Fingerprints)
if len(u.FsConfig.SFTPConfig.Fingerprints) > 0 {
fsConfig.SFTPConfig.Fingerprints = make([]string, len(u.FsConfig.SFTPConfig.Fingerprints))
copy(fsConfig.SFTPConfig.Fingerprints, u.FsConfig.SFTPConfig.Fingerprints)
}
return User{
ID: u.ID,