Skip to content

Commit 9089331

Browse files
committed
VFS: google-drive - cleanup and minor fix (#41)
1 parent a19da56 commit 9089331

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/javascript/vfs/googledrive.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
title: file.filename,
7070
mimeType: contentType
7171
};
72-
//var base64Data = btoa(result); //Utils.btoaUtf(result);
7372
var base64Data = result;
7473
var multipartRequestBody =
7574
delimiter +
@@ -87,26 +86,25 @@
8786

8887
var reqContentType = 'multipart/mixed; boundary=\'' + boundary + '\'';
8988
if ( typeof data === 'string' ) {
90-
var body = createBody(Utils.btoaUtf(data));
9189
callback(false, {
9290
contentType: reqContentType,
93-
body: body
91+
body: createBody(Utils.btoaUtf(data))
9492
});
9593
} else {
9694
var reader = new FileReader();
9795
reader.onload = function(e) {
98-
var body = createBody(btoa(reader.result));
96+
var encoded = btoa(reader.result);
9997
callback(false, {
10098
contentType: reqContentType,
101-
body: body
99+
body: createBody(encoded)
102100
});
103101
};
104102
reader.onerror = function(e) {
105103
callback(e);
106104
};
107105

108106
if ( data instanceof ArrayBuffer ) {
109-
var blob = new Blob([data], {type: reqContentType});
107+
var blob = new Blob([data], {type: contentType});
110108
reader.readAsBinaryString(blob);
111109
} else {
112110
reader.readAsBinaryString(data);

0 commit comments

Comments
 (0)