'dvc gc -c' command not removing unused files if remote path is a subfolder of a S3 bucket
DVC Version: 0.54.1
Platform: Windows (exe)

If I have the remote path set to a subfolder of a S3 bucket and I execute `dvc gc -c`, none unused file will be removed. They are deleted in local cache but no in remote. However, if I execute the same command having set the root of a S3 bucket as remote path, unused files are removed fine in local and remote. I guess this is a bug because I don't see any explicit limitation about it on documentation.

Let me know if you need more info.
diff --git a/dvc/remote/base.py b/dvc/remote/base.py
index 11e42d066..67b174c44 100644
--- a/dvc/remote/base.py
+++ b/dvc/remote/base.py
@@ -516,7 +516,12 @@ class RemoteBASE(object):
         raise NotImplementedError
 
     def path_to_checksum(self, path):
-        return "".join(self.path_cls(path).parts[-2:])
+        parts = self.path_cls(path).parts[-2:]
+
+        if not (len(parts) == 2 and parts[0] and len(parts[0]) == 2):
+            raise ValueError("Bad cache file path")
+
+        return "".join(parts)
 
     def checksum_to_path_info(self, checksum):
         return self.path_info / checksum[0:2] / checksum[2:]
@@ -529,9 +534,12 @@ class RemoteBASE(object):
         # is 32 bytes, so ~3200Mb list) and we don't really need all of it at
         # the same time, so it makes sense to use a generator to gradually
         # iterate over it, without keeping all of it in memory.
-        return (
-            self.path_to_checksum(path) for path in self.list_cache_paths()
-        )
+        for path in self.list_cache_paths():
+            try:
+                yield self.path_to_checksum(path)
+            except ValueError:
+                # We ignore all the non-cache looking files
+                pass
 
     def gc(self, cinfos):
         used = self.extract_used_local_checksums(cinfos)
['dvc/remote/base.py']