From 70f2e502745e2ea309031171e3daf86d3952d2c7 Mon Sep 17 00:00:00 2001 From: Florent Beauchamp Date: Thu, 1 Feb 2024 15:21:02 +0000 Subject: [PATCH] fix(immutable-backups): index files aren't immutable anymore --- @xen-orchestra/immutable-backups/fileIndex.mjs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/@xen-orchestra/immutable-backups/fileIndex.mjs b/@xen-orchestra/immutable-backups/fileIndex.mjs index 05666b09b..397ffa6c6 100644 --- a/@xen-orchestra/immutable-backups/fileIndex.mjs +++ b/@xen-orchestra/immutable-backups/fileIndex.mjs @@ -27,17 +27,6 @@ export async function indexFile(path, immutabilityIndexPath) { if (err.code === 'ENOENT') { await fs.mkdir(dirname(indexFilePath), { recursive: true }) await fs.writeFile(indexFilePath, path) - } else if (err.code === 'EPERM') { - // an immutable file alreay exist : not a problem if it contains the right target - const { size } = await fs.stat(indexFilePath) - if (size.length > 1024 * 1024) { - throw new Error(`Index file at ${indexFilePath} is too big, ${size} bytes `) - } - const existingContent = await fs.readFile(indexFilePath, { encoding: 'utf8' }) - if (existingContent !== path) { - throw new Error(`Index file at ${indexFilePath}, should contains ${path}, but contains ${existingContent}`) - } - throw err } else { throw err }