2
0
Эх сурвалжийг харах

Fix ListDirectories for GCS not working properly

Signed-off-by: Kaelan Patel <kaelanspatel@gmail.com>
Kaelan Patel 3 жил өмнө
parent
commit
aad22fd66b

+ 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,
 			})