From 0ecb8bc2f97a2c3715b41bf7188d97dca5d2a3b5 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 11 Dec 2019 17:23:52 +0000 Subject: [PATCH] s3: fix url decoding of NextMarker - fixes #3799 Before this patch we were failing to URL decode the NextMarker when url encoding was used for the listing. The result of this was duplicated listings entries for directories with >1000 entries where the NextMarker was a file containing a space. --- backend/s3/s3.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index 5fe8cce29..d11c0ea13 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -1398,6 +1398,12 @@ func (f *Fs) list(ctx context.Context, bucket, directory, prefix string, addBuck } else { marker = resp.NextMarker } + if urlEncodeListings { + *marker, err = url.QueryUnescape(*marker) + if err != nil { + return errors.Wrapf(err, "failed to URL decode NextMarker %q", *marker) + } + } } return nil }