From 37c6a96a3a8b5e51cfb67d16400a0f9a83008f11 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Wed, 20 Nov 2019 12:43:08 -0800 Subject: [PATCH] s3: if etag is not present, flag as error --- src/storage/s3.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/storage/s3.js b/src/storage/s3.js index fcd6ce046..d22ea89f0 100644 --- a/src/storage/s3.js +++ b/src/storage/s3.js @@ -220,7 +220,7 @@ function copy(apiConfig, oldFilePath, newFilePath) { if (error) debug(`copy: s3 copy error when copying ${entry.fullPath}: ${error}`); if (error && S3_NOT_FOUND(error)) return iteratorCallback(new BoxError(BoxError.NOT_FOUND, `Old backup not found: ${entry.fullPath}`)); - if (error) return iteratorCallback(new BoxError(BoxError.EXTERNAL_ERROR, `Error copying ${entry.fullPath} : ${error.code} ${error}`)); + if (error) return iteratorCallback(new BoxError(BoxError.EXTERNAL_ERROR, `Error copying ${entry.fullPath} (${entry.size} bytes): ${error.code || ''} ${error}`)); iteratorCallback(null); } @@ -282,6 +282,8 @@ function copy(apiConfig, oldFilePath, newFilePath) { events.emit('progress', `Uploaded part ${partCopyParams.PartNumber} - Etag: ${result.CopyPartResult.ETag}`); + if (!result.CopyPartResult.ETag) return done(new Error('Multi-part copy is broken or not implemented by the S3 storage provider')); + uploadedParts.push({ ETag: result.CopyPartResult.ETag, PartNumber: partNumber }); if (endBytes < size) {