Skip to content

Commit

Permalink
fix(xo-server/rest-api): handle missing content-length
Browse files Browse the repository at this point in the history
Unconditional cast gave `NaN` instead of `undefined` which broke automatic
computation when using VHD.
  • Loading branch information
julien-f committed Sep 18, 2024
1 parent 4debc0f commit 530c30f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- [Hub/Recipes/Kubernetes] Properly sort versions in selector
- [Host/Network] Fix `an error has occurred` briefly displaying in 'Mode' column of the host's Network tab (PR [#7954](https://github.com/vatesfr/xen-orchestra/pull/7954))
- [REST API] Fix VDI export broken in XO 5.96.0 and not completely fixed in XO 5.98.0
- [REST API] Fix VDI import in VHD format when `Content-Length` is not provided

### Packages to release

Expand Down
2 changes: 1 addition & 1 deletion packages/xo-server/src/xo-mixins/rest-api.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ export default class RestApi {
'/:collection(srs)/:object/vdis',
wrap(async (req, res) => {
const sr = req.xapiObject
req.length = +req.headers['content-length']
req.length = ifDef(req.headers['content-length'], Number)

const { name_label, name_description, raw } = req.query
const vdiRef = await sr.$importVdi(req, {
Expand Down

0 comments on commit 530c30f

Please sign in to comment.