nextcloud / nextcloud/integration_google

Documents cannot be downloaded

Open
#172 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug normal priority Stale
Dominant language
JavaScript
Stars
142
Forks
40
PR merge metrics
No merged PRs in 30d

Description

Which version of integration_google are you using?

2.2.0

Which version of Nextcloud are you using?

29.0.1.1

Which browser are you using? In case you are using the phone App, specify the Android or iOS version and device please.

N/A

Describe the Bug

Certain files cause the following to be logged:

{                                                                                                                                                                                                                    
  "reqId": "$REQUEST",
  "level": 2,
  "time": "2024-05-27T09:13:46+00:00",
  "remoteAddr": "",
  "user": "$USER",
  "app": "integration_google",
  "method": "",
  "url": "--",
  "message": "Google API error : Client error: `GET https://www.googleapis.com/drive/v3/files/$FILE?alt=media` resulted in a `403 Forbidden` response:\n{\n  \"error\": {\n    \"code\": 403,\n    \"message\": \"Only files with binary content can be downloaded. Use Export with Docs E (truncated...)\n",
  "userAgent": "--",
  "version": "29.0.1.1",
  "data": {
    "app": "integration_google"
  }
}

I am unsure which files are causing this because no filename is logged.

Expected Behavior

Files are transferred without errors.

To Reproduce

I'm unsure about the repro because I have no sample to share, however I suspect these files are documents. Searching for the error in GitHub returns multiple results, and it seems that there are ways to properly get them.

An example (in Python, sorry): https://github.com/dixonl90/tuxdrive/blob/e71ca0da16b6e03a05b21ef6b58109deb7d2b03d/tuxdrive#L311-L315

			if ("Only files with binary content can be downloaded." in str(ee)):
				print("File not in binary content. Trying the export method.")
				request = service.files().export_media(fileId=file_id,mimeType='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
				fh = open(output_file,'wb') #io.BytesIO()
				downloader = MediaIoBaseDownload(fh, request)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named. Start by tracing the integration_google Google Drive download request shown in the log and how document files are handled; compare the regular media download with the export behavior described in the report. Done means affected documents transfer successfully and the failing file can be identified from the logs.

Written by the indexing model from the issue text.

Assessment

Tech stack
google-cloud, javascript
Domain
backend, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.