From 98884050cc7c2ba5f3e1fd82ac9a405c85413dc0 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Wed, 03 Jul 2013 04:02:20 -0400
Subject: [PATCH] Fix binary data upload with jQuery.ajax()

---
 program/js/app.js |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index 03476b6..19ece01 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -6602,7 +6602,7 @@
         timeout: 0, // disable default timeout set in ajaxSetup()
         data: formdata || multipart,
         headers: {'X-Roundcube-Request': ref.env.request_token},
-        beforeSend: function(xhr, s) { if (!formdata && xhr.sendAsBinary) xhr.send = xhr.sendAsBinary; },
+        xhr: function() { var xhr = jQuery.ajaxSettings.xhr(); if (!formdata && xhr.sendAsBinary) xhr.send = xhr.sendAsBinary; return xhr; },
         success: function(data){ ref.http_response(data); },
         error: function(o, status, err) { ref.http_error(o, status, err, null, 'attachment'); }
       });
@@ -6642,7 +6642,7 @@
             multipart += '; filename="' + (f.name_bin || file.name) + '"' + crlf;
             multipart += 'Content-Length: ' + file.size + crlf;
             multipart += 'Content-Type: ' + file.type + crlf + crlf;
-            multipart += e.target.result + crlf;
+            multipart += reader.result + crlf;
             multipart += dashdash + boundary + crlf;
 
             if (j == last)  // we're done, submit the data

--
Gitblit v1.9.1