소스 검색

Fix ListDirectories for GCS not working properly

Signed-off-by: Kaelan Patel <kaelanspatel@gmail.com>
Kaelan Patel 3 년 전
부모
커밋
aad22fd66b
1개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  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,
 			})
 			})