Skip to content

Commit 2cb900b

Browse files
committed
fix indentation
eslint failed due to incorrect indentation
1 parent 096b729 commit 2cb900b

File tree

2 files changed

+59
-61
lines changed

2 files changed

+59
-61
lines changed

src/dropbox.js

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -406,51 +406,50 @@ Dropbox.prototype = {
406406
meta = resp.getResponseHeader('Dropbox-API-Result');
407407
//first encode the response as text, and later check if
408408
//text appears to actually be binary data
409-
return getTextFromArrayBuffer(resp.response, 'UTF-8')
410-
.then(function (responseText) {
411-
body = responseText;
412-
if (status === 409) {
413-
meta = body;
414-
}
415-
416-
try {
417-
meta = JSON.parse(meta);
418-
} catch(e) {
419-
return Promise.reject(e);
420-
}
421-
422-
if (status === 409) {
423-
if (compareApiError(meta, ['path', 'not_found'])) {
424-
return {statusCode: 404};
425-
}
426-
return Promise.reject(new Error('API error while downloading file ("' + path + '"): ' + meta.error_summary));
427-
}
428-
429-
mime = resp.getResponseHeader('Content-Type');
430-
rev = meta.rev;
431-
self._revCache.set(path, rev);
432-
self._shareIfNeeded(path);
433-
434-
if (shouldBeTreatedAsBinary(responseText, mime)) {
435-
//return unprocessed response
436-
body = resp.response;
437-
} else {
438-
// handling json (always try)
439-
try {
440-
body = JSON.parse(body);
441-
mime = 'application/json; charset=UTF-8';
442-
} catch(e) {
443-
//Failed parsing Json, assume it is something else then
444-
}
445-
}
446-
447-
return {
448-
statusCode: status,
449-
body: body,
450-
contentType: mime,
451-
revision: rev
452-
};
453-
});
409+
return getTextFromArrayBuffer(resp.response, 'UTF-8').then(function (responseText) {
410+
body = responseText;
411+
if (status === 409) {
412+
meta = body;
413+
}
414+
415+
try {
416+
meta = JSON.parse(meta);
417+
} catch(e) {
418+
return Promise.reject(e);
419+
}
420+
421+
if (status === 409) {
422+
if (compareApiError(meta, ['path', 'not_found'])) {
423+
return {statusCode: 404};
424+
}
425+
return Promise.reject(new Error('API error while downloading file ("' + path + '"): ' + meta.error_summary));
426+
}
427+
428+
mime = resp.getResponseHeader('Content-Type');
429+
rev = meta.rev;
430+
self._revCache.set(path, rev);
431+
self._shareIfNeeded(path);
432+
433+
if (shouldBeTreatedAsBinary(responseText, mime)) {
434+
//return unprocessed response
435+
body = resp.response;
436+
} else {
437+
// handling json (always try)
438+
try {
439+
body = JSON.parse(body);
440+
mime = 'application/json; charset=UTF-8';
441+
} catch(e) {
442+
//Failed parsing Json, assume it is something else then
443+
}
444+
}
445+
446+
return {
447+
statusCode: status,
448+
body: body,
449+
contentType: mime,
450+
revision: rev
451+
};
452+
});
454453
});
455454
},
456455

src/googledrive.js

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -463,24 +463,23 @@ GoogleDrive.prototype = {
463463
return this._request('GET', meta.downloadUrl, params).then((response) => {
464464
//first encode the response as text, and later check if
465465
//text appears to actually be binary data
466-
return getTextFromArrayBuffer(response.response, 'UTF-8')
467-
.then(function (responseText) {
468-
let body = responseText;
469-
if (meta.mimeType.match(/^application\/json/)) {
470-
try {
471-
body = JSON.parse(body);
472-
} catch(e) {
473-
// body couldn't be parsed as JSON, so we'll just return it as is
474-
}
475-
} else {
476-
if (shouldBeTreatedAsBinary(responseText, meta.mimeType)) {
477-
//return unprocessed response
478-
body = response.response;
479-
}
466+
return getTextFromArrayBuffer(response.response, 'UTF-8').then(function (responseText) {
467+
let body = responseText;
468+
if (meta.mimeType.match(/^application\/json/)) {
469+
try {
470+
body = JSON.parse(body);
471+
} catch(e) {
472+
// body couldn't be parsed as JSON, so we'll just return it as is
480473
}
474+
} else {
475+
if (shouldBeTreatedAsBinary(responseText, meta.mimeType)) {
476+
//return unprocessed response
477+
body = response.response;
478+
}
479+
}
481480

482-
return {statusCode: 200, body: body, contentType: meta.mimeType, revision: etagWithoutQuotes};
483-
});
481+
return {statusCode: 200, body: body, contentType: meta.mimeType, revision: etagWithoutQuotes};
482+
});
484483
});
485484
});
486485
});

0 commit comments

Comments
 (0)