From f6020f13080647ca2e48b895266cf6e7900bccf4 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 19 Mar 2018 17:42:27 +0000 Subject: [PATCH] gcs: ignore zero length directory markers --- backend/googlecloudstorage/googlecloudstorage.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/googlecloudstorage/googlecloudstorage.go b/backend/googlecloudstorage/googlecloudstorage.go index e16518835..7e2cd5c65 100644 --- a/backend/googlecloudstorage/googlecloudstorage.go +++ b/backend/googlecloudstorage/googlecloudstorage.go @@ -437,6 +437,17 @@ func (f *Fs) list(dir string, recurse bool, fn listFn) error { continue } remote := object.Name[rootLength:] + // is this a directory marker? + if strings.HasSuffix(remote, "/") && object.Size == 0 { + if recurse { + // add a directory in if --fast-list since will have no prefixes + err = fn(remote[:len(remote)-1], object, true) + if err != nil { + return err + } + } + continue // skip directory marker + } err = fn(remote, object, false) if err != nil { return err