From 4fe6614ae11ec7d0131c78b93360dba642ebea8d Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 9 Jul 2018 17:00:05 +0100 Subject: [PATCH] s3: fix index out of range error with --fast-list fixes #2388 --- backend/s3/s3.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index b2cd37ccf..da094bfad 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -864,7 +864,7 @@ func (f *Fs) list(dir string, recurse bool, fn listFn) error { remote := key[rootLength:] // is this a directory marker? if (strings.HasSuffix(remote, "/") || remote == "") && *object.Size == 0 { - if recurse { + if recurse && remote != "" { // add a directory in if --fast-list since will have no prefixes remote = remote[:len(remote)-1] err = fn(remote, &s3.Object{Key: &remote}, true)