fix(xo-server/backup legacy/delta import): autofix path (#2941)

Because the path might be incorrect and be `_full.vhd` instead of `_delta.vhd`.

I know…
This commit is contained in:
Julien Fontanet 2018-05-11 20:16:00 +02:00 committed by GitHub
parent bcb66a4145
commit 2f256291ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -815,10 +815,17 @@ export default class {
await Promise.all(
mapToArray(delta.vdis, async (vdi, id) => {
streams[`${id}.vhd`] = await createVhdReadStream(
handler,
`${basePath}/${vdi.xoPath}`
)
let path = `${basePath}/${vdi.xoPath}`
try {
await handler.getSize(path)
} catch (error) {
if (error == null || error.code !== 'ENOENT') {
throw error
}
path = path.replace(/_delta\.vhd$/, '_full')
}
streams[`${id}.vhd`] = await createVhdReadStream(handler, path)
})
)