File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -411,12 +411,18 @@ export default class GoogleDriveAdapter extends CachingAdapter {
411411 throw new NetworkError ( )
412412 }
413413
414- if ( res . status === 401 || res . status === 403 ) {
415- Logger . log ( 'Failed to authenticate to Google API: ' + res . data )
414+ if ( res . status === 401 ) {
415+ Logger . log ( 'Failed to authenticate to Google API: ' + JSON . stringify ( res . data ) )
416416 throw new AuthenticationError ( )
417417 }
418418
419+ if ( res . status === 403 ) {
420+ Logger . log ( 'Google API error: ' + JSON . stringify ( res . data ) )
421+ throw new HttpError ( res . status , method )
422+ }
423+
419424 if ( res . status >= 500 ) {
425+ Logger . log ( 'Google API error: ' + JSON . stringify ( res . data ) )
420426 throw new HttpError ( res . status , method )
421427 }
422428
@@ -438,7 +444,8 @@ export default class GoogleDriveAdapter extends CachingAdapter {
438444 }
439445
440446 async downloadFile ( id : string ) : Promise < string > {
441- const res = await this . request ( 'GET' , this . getUrl ( ) + '/files/' + id + '?alt=media' )
447+ // We acknowledge abuse so that Google Drive will give us the file contents even if it thinks it's a virus.
448+ const res = await this . request ( 'GET' , this . getUrl ( ) + '/files/' + id + '?alt=media' + '&acknowledgeAbuse=true' )
442449 return res . text ( )
443450 }
444451
You can’t perform that action at this time.
0 commit comments