Skip to content

Commit

Permalink
fix(sys): process bucket name & mode for old version compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed May 3, 2022
1 parent 8c55690 commit 6846ede
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/system-server/src/support/importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,15 @@ export class ApplicationImporter {
if (existed) return

const oss = await MinioAgent.New()
const internalName = `${this.app.appid}-${name}`
const ret = await oss.createBucket(internalName, { acl: mode })
const full_name = `${this.app.appid}-${name}`

// process bucket name & mode for old version compatibility
const internal_name = full_name.replace('_', '-')
if (mode as any === 0) mode = BUCKET_ACL.private
if (mode as any === 1) mode = BUCKET_ACL.readonly
if (mode as any === 2) mode = BUCKET_ACL.public

const ret = await oss.createBucket(internal_name, { acl: mode })
if (!ret) {
throw new Error(`Failed to create bucket: ${name}`)
}
Expand Down

0 comments on commit 6846ede

Please sign in to comment.