From e069fc439e62c9a1827129bc7ebe67334dca1dbe Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 15 Jun 2017 16:45:21 +0100 Subject: [PATCH] crypt: use an in place filter for encrypting directory entries --- crypt/crypt.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crypt/crypt.go b/crypt/crypt.go index 4f32ff4c5..571a857bf 100644 --- a/crypt/crypt.go +++ b/crypt/crypt.go @@ -170,9 +170,9 @@ func (f *Fs) addDir(entries *fs.DirEntries, dir *fs.Dir) { *entries = append(*entries, f.newDir(dir)) } -// Encrypt some directory entries +// Encrypt some directory entries. This alters entries returning it as newEntries. func (f *Fs) encryptEntries(entries fs.DirEntries) (newEntries fs.DirEntries, err error) { - newEntries = make(fs.DirEntries, 0, len(entries)) + newEntries = entries[:0] // in place filter for _, entry := range entries { switch x := entry.(type) { case fs.Object: