FIX: Disable multipart backup uploads to S3

FIX: Disable multipart backup uploads to S3

Multipart upload from within the browser result in corrupt files on S3.

diff --git a/app/assets/javascripts/discourse/components/backup-uploader.js.es6 b/app/assets/javascripts/discourse/components/backup-uploader.js.es6
index 3b54695..62fbb81 100644
--- a/app/assets/javascripts/discourse/components/backup-uploader.js.es6
+++ b/app/assets/javascripts/discourse/components/backup-uploader.js.es6
@@ -28,7 +28,8 @@ export default Em.Component.extend(UploadMixin, {
     return {
       type: "PUT",
       dataType: "xml",
-      autoUpload: false
+      autoUpload: false,
+      multipart: false
     };
   },

GitHub
sha: 32784ad1

I presume this will break spectacularly if someone tries to upload a file that is larger than the S3 single part upload size limit. I know that’s quite a large number, but someone’s going to try try it sooner or later, and I presume it’ll not go well. Should there be some sort of sanity check made on the file size before the user sits down to wait for their 5.01GB of data to upload?

3 Likes

This just disables the use of the multipart/form-data Content-Type. We always uploaded the backup as single part to S3, but now the uploaded file isn’t broken anymore. That was a design decision for v1 of this feature.

Sure, checking the file size is a good idea. I’m adding it to my list. But in the long run we want to use the S3 API for Multipart Upload.

2 Likes