Explorar o código

Merge pull request #1541 from kaelanspatel/kaelan-fix-gcs-listdirectories

Fix ListDirectories for GCS not working properly
Kaelan Patel %!s(int64=3) %!d(string=hai) anos
pai
achega
7a434fb192
Modificáronse 1 ficheiros con 4 adicións e 3 borrados
  1. 4 3
      pkg/storage/gcsstorage.go

+ 4 - 3
pkg/storage/gcsstorage.go

@@ -270,10 +270,11 @@ func (gs *GCSStorage) ListDirectories(path string) ([]*StorageInfo, error) {
 			continue
 		}
 
-		// If trim removes the entire name, it's a directory, ergo we list it
-		if trimName(attrs.Name) == "" {
+		// We filter directories using DirDelim, so a nameless entry is a dir
+		// See gcs.ObjectAttrs Prefix property
+		if attrs.Name == "" {
 			stats = append(stats, &StorageInfo{
-				Name:    attrs.Name,
+				Name:    attrs.Prefix,
 				Size:    attrs.Size,
 				ModTime: attrs.Updated,
 			})