@@ -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
0 commit comments