Skip to content

Commit e099336

Browse files
committed
fix the blob issue
1 parent 30f51b3 commit e099336

File tree

5 files changed

+19
-17
lines changed

5 files changed

+19
-17
lines changed

files.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ XMLHttpRequest.prototype.sendMultipart = function(params) {
5757
if(binxhr){
5858
var req = '', append = function(data){req += data}
5959
}else{
60-
var req = new BlobBuilder(), append = function(data){req.append(data)}
60+
var req = [], append = function(data){req.push(data)}
6161
}
6262

6363
append("--" + BOUNDARY);
@@ -115,7 +115,7 @@ XMLHttpRequest.prototype.sendMultipart = function(params) {
115115
if(binxhr){
116116
xhr.sendAsBinary(req);
117117
}else{
118-
superblob = req.getBlob();
118+
superblob = new Blob(req);
119119
xhr.send(superblob);
120120
}
121121
});

hosts/google/docs.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
Hosts.gdocs = function uploadGDocs(req, callback){
22

33
getBuffer(req, function(file){
4-
var builder = new BlobBuilder();
5-
builder.append(file.data);
6-
4+
// var builder = new BlobBuilder();
5+
// builder.append(file.data);
76

87
function handleErrors(resp){
98
if(resp.indexOf("ServiceForbiddenException") != -1){
@@ -61,7 +60,8 @@ Hosts.gdocs = function uploadGDocs(req, callback){
6160

6261

6362
console.log('uploading new mime type', file.type);
64-
var blob = builder.getBlob(file.type);
63+
//var blob = builder.getBlob(file.type);
64+
var blob = new Blob([file.data], {type: file.type});
6565

6666
GoogleOAUTH.sendSignedRequest(
6767
'https://docs.google.com/feeds/upload/create-session/default/private/full',

hosts/google/picasa.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ Hosts.picasa = function uploadPicasa(req, callback){
2222
};
2323

2424
getBuffer(req, function(file){
25-
var builder = new BlobBuilder();
26-
builder.append(file.data);
27-
28-
25+
//var builder = new BlobBuilder();
26+
//builder.append(file.data);
27+
var blob = new Blob([file.data], {type: file.type});
2928

3029
function complete(resp, xhr){
3130
var prs = JSON.parse(resp);
@@ -79,7 +78,8 @@ xmlns:media='http://search.yahoo.com/mrss/'\
7978
parameters: {
8079
alt: 'json'
8180
},
82-
body: builder.getBlob(file.type)
81+
//body: builder.getBlob(file.type)
82+
body: blob
8383
});
8484

8585

hosts/sugarsync.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ Hosts.sugarsync = function uploadsugarsync(req, callback){
4343

4444
function upload(ref){
4545
getBuffer(req, function(file){
46-
var builder = new BlobBuilder();
47-
builder.append(file.data);
48-
var blob = builder.getBlob();
46+
//var builder = new BlobBuilder();
47+
//builder.append(file.data);
48+
//var blob = builder.getBlob();
49+
var blob = new Blob([file.data]);
4950
var xhr = new XMLHttpRequest();
5051
xhr.open('PUT', ref+'/data', true);
5152
xhr.setRequestHeader('Authorization', localStorage.sugarsync_auth);

hosts/webdav/dav.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ Hosts.webdav = function uploadWebDAV(req, callback){
1616
var fs = new WebDAV.Fs(localStorage.webdav_url);
1717
WebDAV.auth = localStorage.webdav_auth; //this is a nasty hack
1818
getRaw(req, function(file){
19-
var body = new BlobBuilder();
19+
//var body = new BlobBuilder();
2020
var bin = file.data, arr = new Uint8Array(bin.length);
2121
for(var i = 0; i < bin.length; i++){
2222
arr[i] = bin.charCodeAt(i);
2323
}
24-
body.append(arr.buffer);
25-
fs.file("/"+file.name).write(body.getBlob(), function(body, xhr){
24+
//body.append(arr.buffer);
25+
var body = new Blob([arr.buffer]);
26+
fs.file("/"+file.name).write(body, function(body, xhr){
2627
if(xhr.status >= 200 && xhr.status < 300){
2728
callback("Yay I think this means it works");
2829
}else{

0 commit comments

Comments
 (0)