Bug 1348691 - fix Box.com filelink uploads. r=jorgk a=jorgk
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Sun, 19 Mar 2017 22:58:47 +0200
changeset 27456 d0bd483dd2b5afe7a261d5e574d072e73e953d6b
parent 27455 f47e8332b92ef5f5b2d2580222be12c28a16f975
child 27457 32087f2e8d4e72e1765d0d9a5dd9c1a6adc466bc
push id1886
push usermozilla@jorgk.com
push dateMon, 20 Mar 2017 17:11:37 +0000
treeherdercomm-beta@32087f2e8d4e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk, jorgk
bugs1348691
Bug 1348691 - fix Box.com filelink uploads. r=jorgk a=jorgk
mail/components/cloudfile/nsBox.js
--- a/mail/components/cloudfile/nsBox.js
+++ b/mail/components/cloudfile/nsBox.js
@@ -774,23 +774,24 @@ nsBoxFileUploader.prototype = {
       if (this.callback)
         this.callback(this.requestObserver,
                       Ci.nsIMsgCloudFileProvider.uploadErr);
     }.bind(this);
 
     req.setRequestHeader("Authorization", "Bearer " + this.box._oauth.accessToken);
 
     // Encode the form.
-    let file = new File(this.file);
-    let form = Cc["@mozilla.org/files/formdata;1"]
-                 .createInstance(Ci.nsIDOMFormData);
-    form.append("filename", file, this.file.leafName);
-    form.append("parent_id", this.box._cachedFolderId);
+    File.createFromNsIFile(this.file).then(file => {
+      let form = Cc["@mozilla.org/files/formdata;1"]
+                   .createInstance(Ci.nsIDOMFormData);
+      form.append("filename", file, this.file.leafName);
+      form.append("parent_id", this.box._cachedFolderId);
 
-    req.send(form);
+      req.send(form);
+    });
   },
 
   /**
    * Cancels the upload request for the file associated with this Uploader.
    */
   cancel: function nsBox_cancel() {
     this.log.info("in uploader cancel");
     this.callback(this.requestObserver, Ci.nsIMsgCloudFileProvider.uploadCanceled);