Kaynağa Gözat

Fix ListDirectories for GCS not working properly

Signed-off-by: Kaelan Patel <kaelanspatel@gmail.com>
Kaelan Patel 3 yıl önce
ebeveyn
işleme
aad22fd66b
1 değiştirilmiş dosya ile 4 ekleme ve 3 silme
  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,
 			})