From d8e01b2867cef5958dc372c7370427b728368193 Mon Sep 17 00:00:00 2001 From: Florent BEAUCHAMP Date: Thu, 1 Sep 2022 12:51:44 +0200 Subject: [PATCH] =?UTF-8?q?fix(fs/s3#copy):=20normalize=20error:=20no=20su?= =?UTF-8?q?ch=20key=20=E2=86=92=20ENOENT=20(#6388)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- @xen-orchestra/fs/src/s3.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/@xen-orchestra/fs/src/s3.js b/@xen-orchestra/fs/src/s3.js index 9d429fac4..c91831c58 100644 --- a/@xen-orchestra/fs/src/s3.js +++ b/@xen-orchestra/fs/src/s3.js @@ -155,6 +155,14 @@ export default class S3Handler extends RemoteHandlerAbstract { if (e.name === 'EntityTooLarge') { return this._multipartCopy(oldPath, newPath) } + // normalize this error code + if (e.name === 'NoSuchKey') { + const error = new Error(`ENOENT: no such file or directory '${oldPath}'`) + error.cause = e + error.code = 'ENOENT' + error.path = oldPath + throw error + } throw e } }