fix(xen-api): don't normalize/trim strings in XML-RPC

This applies to both XML-RPC transport and results of XAPI tasks.

Before this commit, all whitespaces (spaces, new lines, etc.) were reduces to
a single whitespaces and leading and trailing whitespaces where removed.

This led to malformed values such as the result of `host.get_server_certificate`.
This commit is contained in:
Julien Fontanet
2024-09-19 16:17:56 +02:00
parent 2b1d6f21a0
commit 63a88b1525
3 changed files with 5 additions and 2 deletions

View File

@@ -44,6 +44,7 @@
- @xen-orchestra/web minor
- @xen-orchestra/web-core minor
- @xen-orchestra/xapi patch
- xen-api patch
- xo-cli minor
- xo-server patch
- xo-web minor

View File

@@ -20,6 +20,8 @@ export default task => {
// - an opaque reference
// - an XML-RPC value
const { result } = task
return Promise.resolve(result === '' ? '' : xmlRpcParser.parse_value(parseXml(result)))
return Promise.resolve(
result === '' ? '' : xmlRpcParser.parse_value(parseXml(result + '\n', { normalize: false, trim: false }))
)
}
}

View File

@@ -53,7 +53,7 @@ export default ({ dispatcher, url }) => {
}
const xml = await res.body.text()
const response = xmlRpcParser.parse(parseXml(xml))
const response = xmlRpcParser.parse(parseXml(xml, { normalize: false, trim: false }))
return parseResult(response.params[0])
}