Skip to content

Commit

Permalink
fix(hover): fix hoverDelete when customDomain has been set
Browse files Browse the repository at this point in the history
  • Loading branch information
fangbinwei committed Jul 26, 2020
1 parent 57de688 commit 77241df
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
14 changes: 10 additions & 4 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,16 @@ export function isAliyunOssUri(uri: string): boolean {

if (!['http', 'https'].includes(vsUri.scheme)) return false

const { bucket, region } = getElanConfiguration()
const [_bucket, _region] = vsUri.authority.split('.')
if (bucket !== _bucket) return false
if (region !== _region) return false
const { bucket, region, customDomain } = getElanConfiguration()
// the priority of customDomain is highest
if (customDomain) {
if (vsUri.authority !== customDomain) return false
} else {
// consider bucket and region when no customDomain
const [_bucket, _region] = vsUri.authority.split('.')
if (bucket !== _bucket) return false
if (region !== _region) return false
}

const ext = path.extname(vsUri.path).substr(1)
if (!SUPPORT_EXT.includes(ext.toLowerCase())) return false
Expand Down
7 changes: 6 additions & 1 deletion src/views/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,12 @@ export class BucketExplorerProvider
return _prefixes.concat(_objects)
} catch (err) {
Logger.showErrorMessage(
'Failed to list Objects. See output channel for more details.'
'Failed to list objects. See output channel for more details.'
)
Logger.log(
`Failed: list objects.` +
` Reason: ${err.message}` +
` If you set customDomain, is it match to the bucket? `
)
return [this.getOSSObjectErrorTreeItem()]
}
Expand Down

0 comments on commit 77241df

Please sign in to comment.