From 862d5d608621207f72ada978305f84955213fb69 Mon Sep 17 00:00:00 2001 From: nielash Date: Mon, 29 Apr 2024 03:21:49 -0400 Subject: [PATCH] s3, googlecloudstorage, azureblob: fix encoding issue with dir path comparison `remote` has been converted ToStandardPath a few lines above, so `directory` needs to be converted the same way in order to be compared properly. This was spotted on `TestBisyncRemoteRemote/extended_filenames` for `TestS3,directory_markers:` and `TestGoogleCloudStorage,directory_markers:` which tripped over a directory name containing a Line Feed symbol. --- backend/azureblob/azureblob.go | 2 +- backend/googlecloudstorage/googlecloudstorage.go | 2 +- backend/s3/s3.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go index 9855170d2..6c07a3320 100644 --- a/backend/azureblob/azureblob.go +++ b/backend/azureblob/azureblob.go @@ -1088,7 +1088,7 @@ func (f *Fs) list(ctx context.Context, containerName, directory, prefix string, isDirectory := isDirectoryMarker(*file.Properties.ContentLength, file.Metadata, remote) if isDirectory { // Don't insert the root directory - if remote == directory { + if remote == f.opt.Enc.ToStandardPath(directory) { continue } // process directory markers as directories diff --git a/backend/googlecloudstorage/googlecloudstorage.go b/backend/googlecloudstorage/googlecloudstorage.go index 1d1bffaee..07f589ab8 100644 --- a/backend/googlecloudstorage/googlecloudstorage.go +++ b/backend/googlecloudstorage/googlecloudstorage.go @@ -697,7 +697,7 @@ func (f *Fs) list(ctx context.Context, bucket, directory, prefix string, addBuck // is this a directory marker? if isDirectory { // Don't insert the root directory - if remote == directory { + if remote == f.opt.Enc.ToStandardPath(directory) { continue } // process directory markers as directories diff --git a/backend/s3/s3.go b/backend/s3/s3.go index 6f1ded7f1..40dbf807a 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -4065,7 +4065,7 @@ func (f *Fs) list(ctx context.Context, opt listOpt, fn listFn) error { isDirectory = false } else { // Don't insert the root directory - if remote == opt.directory { + if remote == f.opt.Enc.ToStandardPath(opt.directory) { continue } }