fix(xo-server/rest-api/VM export): 404 error if UUID is not a VM

This commit is contained in:
Julien Fontanet
2022-03-28 11:01:09 +02:00
parent 7e8c524a43
commit e42edf2164

View File

@@ -121,7 +121,7 @@ export default class RestApi {
api.get('/vms/:uuid.xva', async (req, res, next) => {
try {
const vm = await app.getXapiObject(req.params.uuid)
const vm = await app.getXapiObject(req.params.uuid, 'VM')
const stream = await vm.$xapi.VM_export(vm.$ref, { compress: req.query.compress })
stream.headers['content-disposition'] = 'attachment'