Pārlūkot izejas kodu

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

Fix ListDirectories for GCS not working properly
Kaelan Patel 3 gadi atpakaļ
vecāks
revīzija
7a434fb192
1 mainītis faili ar 4 papildinājumiem un 3 dzēšanām
  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
 			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{
 			stats = append(stats, &StorageInfo{
-				Name:    attrs.Name,
+				Name:    attrs.Prefix,
 				Size:    attrs.Size,
 				Size:    attrs.Size,
 				ModTime: attrs.Updated,
 				ModTime: attrs.Updated,
 			})
 			})