Skip to content

Commit

Permalink
fix(S3): handle empty directory
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeauchamp committed May 4, 2022
1 parent 2518395 commit 9ac896c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 7 additions & 4 deletions @xen-orchestra/fs/src/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ export default class S3Handler extends RemoteHandlerAbstract {
})

// Workaround for https://github.com/aws/aws-sdk-js-v3/issues/2673
this._s3.middlewareStack.use(
getApplyMd5BodyChecksumPlugin(this._s3.config)
)
this._s3.middlewareStack.use(getApplyMd5BodyChecksumPlugin(this._s3.config))

const parts = split(path)
this._bucket = parts.shift()
Expand All @@ -99,7 +97,12 @@ export default class S3Handler extends RemoteHandlerAbstract {
}

_makePrefix(dir) {
return join(this._dir, dir, '/')
const prefix = join(this._dir, dir, '/')

// no prefix for root
if (prefix !== './') {
return prefix
}
}

_createParams(file) {
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

> Users must be able to say: “I had this issue, happy to know it's fixed”
- [S3] Fix S3 remote with empty directory not showing anything to restore (PR [#6218](https://github.com/vatesfr/xen-orchestra/pull/6218))

### Packages to release

> Packages will be released in the order they are here, therefore, they should
Expand All @@ -33,5 +35,11 @@
<!--packages-start-->

- @xen-orchestra/fs patch
- vhd-cli patch
- @xen-orchestra/backups patch
- xo-server patch
- @xen-orchestra/backups-cli patch
- @xen-orchestra/proxy patch

<!--packages-end-->

0 comments on commit 9ac896c

Please sign in to comment.