Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documents cannot be downloaded #172

Open
bardo opened this issue May 27, 2024 · 7 comments
Open

Documents cannot be downloaded #172

bardo opened this issue May 27, 2024 · 7 comments
Labels
bug Something isn't working normal priority

Comments

@bardo
Copy link

bardo commented May 27, 2024

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)
@bardo bardo added the bug Something isn't working label May 27, 2024
Copy link

Hello 👋

Thank you for taking the time to open this issue with integration_google. I know it's frustrating when software
causes problems. You have made the right choice to come here and open an issue to make sure your problem gets looked at
and if possible solved.
We try to answer all issues and if possible fix all bugs here, but it sometimes takes a while until we get to it.
Until then, please be patient. If you are strugging to set up the app, have a look at this video: https://www.youtube.com/watch?v=h_teJPg2wEk
Note also that GitHub is a place where people meet to make software better together. Nobody here is under any obligation
to help you, solve your problems or deliver on any expectations or demands you may have, but if enough people come together we can
collaborate to make this software better. For everyone.
Thus, if you can, you could also look at other issues to see whether you can help other people with your knowledge
and experience. If you have coding experience it would also be awesome if you could step up to dive into the code and
try to fix the odd bug yourself. Everyone will be thankful for extra helping hands!
One last word: If you feel, at any point, like you need to vent, this is not the place for it; you can go to the forum,
to twitter or somewhere else. But this is a technical issue tracker, so please make sure to
focus on the tech and keep your opinions to yourself. (Also see our Code of Conduct. Really.)

I look forward to working with you on this issue
Cheers 💙

@marcelklehr marcelklehr changed the title Error: "Only files with binary content can be downloaded" Documents cannot be downloaded Jun 4, 2024
@marcelklehr
Copy link
Member

You might be able to find out which file it is by accessing a file in your drive via the web UI and then replacing the id in the URL with the id in the Error URL. That might open the file in your browser.

@marcelklehr
Copy link
Member

We do try to infer from the mime type which files are documents and automatically use the export method.

@bardo
Copy link
Author

bardo commented Jul 4, 2024

Unfortunately I cannot access the file on Drive because it's from one of my users. I'll try to repro on my account though.

What I could see is that the Activity log shows the creation and subsequent deletion of docx/pptx files, so I assume that those are the problematic ones. Would there be any difference if ODF formats were selected in the settings?

Can you also point me to the logic that processes these files? I am not a PHP expert, but I can try to have a look.

Copy link

github-actions bot commented Oct 3, 2024

Hello 👋
This issue appears to have had no activity for 3 months. We cannot keep track of whether individual issues
have resolved themselves or still require attention without user interaction. We're thus adding the stale label to this issue to schedule
it for getting closed in 5 days time. If you believe this issue is still valid and should be fixed, you can add a comment
or remove the label to avoid it getting closed.

Cheers 💙

@github-actions github-actions bot added the Stale label Oct 3, 2024
Copy link

github-actions bot commented Oct 8, 2024

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 8, 2024
@marcelklehr marcelklehr reopened this Oct 8, 2024
@marcelklehr
Copy link
Member

@marcelklehr marcelklehr removed the Stale label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working normal priority
Projects
None yet
Development

No branches or pull requests

2 participants