Skip to content

Commit 5f6916b

Browse files
committed
fix(bucketExplorer): ext case-insensitive
1 parent 81c0606 commit 5f6916b

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/utils/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function isAliyunOssUri(uri: string): boolean {
5656
if (region !== _region) return false
5757

5858
const ext = path.extname(vsUri.path).substr(1)
59-
if (!SUPPORT_EXT.includes(ext)) return false
59+
if (!SUPPORT_EXT.includes(ext.toLowerCase())) return false
6060

6161
return true
6262
} catch {

src/views/bucket.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,7 @@ export class BucketExplorerProvider
9393

9494
prefix = prefix === this.uploader.configuration.bucket ? '' : prefix + '/'
9595

96-
const res = await this.uploader.list({
97-
prefix
98-
})
96+
const res = await this.uploader.list({ prefix })
9997
// we should create an empty 'folder' sometimes
10098
// this 'empty object' is the 'parent folder' of these objects
10199
let emptyObjectIndex: null | number = null
@@ -117,11 +115,15 @@ export class BucketExplorerProvider
117115
if (this.uploader.configuration.onlyShowImages) {
118116
//TODO: after realizing pagination, we can show all ext
119117
filteredObject = res.objects.filter((o) => {
120-
return SUPPORT_EXT.includes(path.extname(o.name).substr(1))
118+
return SUPPORT_EXT.includes(
119+
path.extname(o.name).substr(1).toLowerCase()
120+
)
121121
})
122122
}
123123
const _objects = filteredObject.map((p, index) => {
124-
const isImage = SUPPORT_EXT.includes(path.extname(p.name).substr(1))
124+
const isImage = SUPPORT_EXT.includes(
125+
path.extname(p.name).substr(1).toLowerCase()
126+
)
125127
const isEmpty = index === emptyObjectIndex
126128
return new OSSObjectTreeItem({
127129
...commonOptions,

0 commit comments

Comments
 (0)