No, jQuery, don't processData!
processData (default: true) Type: Boolean By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, set this option to false. https://api.jquery.com/jQuery.ajax/
This commit is contained in:
parent
211129475c
commit
e35148add8
1 changed files with 8 additions and 7 deletions
15
js/api.js
15
js/api.js
|
@ -257,16 +257,17 @@ window.textsecure.api = function() {
|
||||||
var id_regex = RegExp( "^https:\/\/" + ATTACHMENT_HOST + "\/(\\d+)\?");
|
var id_regex = RegExp( "^https:\/\/" + ATTACHMENT_HOST + "\/(\\d+)\?");
|
||||||
self.putAttachment = function(encryptedBin) {
|
self.putAttachment = function(encryptedBin) {
|
||||||
return doAjax({
|
return doAjax({
|
||||||
call : 'attachment',
|
call : 'attachment',
|
||||||
httpType : 'GET',
|
httpType : 'GET',
|
||||||
do_auth : true,
|
do_auth : true,
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
$.ajax(response.location, {
|
$.ajax(response.location, {
|
||||||
type : "PUT",
|
type : "PUT",
|
||||||
headers : {"Content-Type" : "application/octet-stream"},
|
headers : {"Content-Type" : "application/octet-stream"},
|
||||||
data : encryptedBin,
|
data : encryptedBin,
|
||||||
success : function() {
|
processData : false,
|
||||||
|
success : function() {
|
||||||
try {
|
try {
|
||||||
// Parse the id as a string from the location url
|
// Parse the id as a string from the location url
|
||||||
// (workaround for ids too large for Javascript numbers)
|
// (workaround for ids too large for Javascript numbers)
|
||||||
|
|
Loading…
Reference in a new issue