From 7f2aba6747d75302e495a466dc42de55b07926ed Mon Sep 17 00:00:00 2001 From: "Thomas E. Horner" Date: Thu, 9 Aug 2018 13:47:35 +0200 Subject: [PATCH] fix uploading files using drag 'n drop together with a change in compose-dimp.js --- js/prototype.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/prototype.js b/js/prototype.js index 452ef4dd9..8d2c9c7ef 100644 --- a/js/prototype.js +++ b/js/prototype.js @@ -1762,8 +1762,16 @@ Ajax.Request = Class.create(Ajax.Base, { }; if (this.method == 'post') { - headers['Content-type'] = this.options.contentType + - (this.options.encoding ? '; charset=' + this.options.encoding : ''); + /* For an XHR to properly post a multipart/form-data + * it's crucial that the Content-type header is set by + * the browser itself for the boundary to be correct. + * A script must explicitly set contentType to 'false' + * in this case so we don't set the Content-Type header. + */ + if (this.options.contentType!=false) { + headers['Content-type'] = this.options.contentType + + (this.options.encoding ? '; charset=' + this.options.encoding : ''); + } /* Force "Connection: close" for older Mozilla browsers to work * around a bug where XMLHttpRequest sends an incorrect