mirror of
https://github.com/vatesfr/xen-orchestra.git
synced 2026-11-09 17:06:13 -06:00
fix(vhd-lib/createVhdStreamWithLength): fix empty VHD handling
Follow-up of4e9477f34Introduced byc26a7a3e5
This commit is contained in:
@@ -41,12 +41,14 @@ module.exports = async function createVhdStreamWithLength(stream) {
|
||||
let streamPosition = 0
|
||||
|
||||
async function readStream(length) {
|
||||
if (length !== 0) {
|
||||
const chunk = await readChunkStrict(stream, length)
|
||||
streamPosition += length
|
||||
readBuffers.push(chunk)
|
||||
return chunk
|
||||
if (length === 0) {
|
||||
return Buffer.alloc(0)
|
||||
}
|
||||
|
||||
const chunk = await readChunkStrict(stream, length)
|
||||
streamPosition += length
|
||||
readBuffers.push(chunk)
|
||||
return chunk
|
||||
}
|
||||
|
||||
const footerBuffer = await readStream(FOOTER_SIZE)
|
||||
|
||||
Reference in New Issue
Block a user