Thanks to visit codestin.com
Credit goes to github.com

Skip to content

drive: send acknowledgeAbuse=true on every download when --drive-acknowledge-abuse - #9914

Open
Masterxilo wants to merge 1 commit into
rclone:masterfrom
Masterxilo:acknowledge-abuse-always
Open

drive: send acknowledgeAbuse=true on every download when --drive-acknowledge-abuse#9914
Masterxilo wants to merge 1 commit into
rclone:masterfrom
Masterxilo:acknowledge-abuse-always

Conversation

@Masterxilo

Copy link
Copy Markdown

What does this change do?

Google holds every download of an executable for about 27 seconds before the first byte, whatever the file size, to malware-scan it on each request. Nautilus asks GIO for the content type of every file, and GIO opens any file whose extension is ambiguous to sniff its bytes. Four system mime types claim .exe, so it is always ambiguous. Three .exe files in the root of a Google Drive, each sniffed twice for type and icon, gave a 3-minute "Loading" hang in Nautilus on an rclone mount.

A user-level or system-level mime override to stop GIO from sniffing .exe does not work. GLib merges all mime caches and ignores the delete markers. Both attempts were reverted.

Adding acknowledgeAbuse=true to the download request skips the scan entirely: 0.4 seconds instead of 27. rclone only sent that parameter after a cannotDownloadAbusiveFile error, so --drive-acknowledge-abuse never helped with downloads that succeed slowly. Send it up front when the option is set.

Measured with this patch: 3 seconds versus 30 seconds for the same 4 KiB read of an .exe, and the Nautilus listing of a folder with multiple .exe dropped from 175 s to 3 s.

Checklist

  • This change is trivial OR it has been discussed and agreed in the linked issue.
  • I have read the contribution guidelines.
  • (If I used AI tools to help write this code) I have read and understood the AI-assisted contributions guidance, and I have tested and take ownership of this change myself.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • (Backend changes only) test_all passes for this backend and if submitting a new backend can provide a test account for the integration tester - see CONTRIBUTING.md.
  • This Pull Request is ready for review.

…owledge-abuse is set

Google holds every download of an executable for about 27 seconds
before the first byte, whatever the file size, to malware-scan it on
each request. Nautilus asks GIO for the content type of every file, and
GIO opens any file whose extension is ambiguous to sniff its bytes. Four
system mime types claim .exe, so it is always ambiguous. Three .exe
files in the root of a Google Drive, each sniffed twice for type and
icon, gave a 3-minute "Loading" hang in Nautilus on an rclone mount.

Adding acknowledgeAbuse=true to the download request skips the scan
entirely: 0.4 seconds instead of 27. rclone only sent that parameter
after a cannotDownloadAbusiveFile error, so --drive-acknowledge-abuse
never helped with downloads that succeed slowly. Send it up front when
the option is set.

Measured with this patch: 3 seconds versus 30 seconds for the same
4 KiB read of an .exe, and the Nautilus listing of that folder dropped
from 175 s to 3 s.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@Masterxilo
Masterxilo requested a review from ncw as a code owner September 12, 2026 23:50
Copilot AI lite review requested due to automatic review settings September 12, 2026 23:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The retry can duplicate the parameter, and focused tests plus generated-documentation cleanup are still needed.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Updates Google Drive downloads to send acknowledgeAbuse=true proactively when enabled, avoiding malware-scan delays.

Changes:

  • Adds proactive acknowledgment to download requests.
  • Documents the updated behavior.
File summaries
File Summary Findings
docs/content/drive.md Documents the updated option behavior. Nit (1 vote): Remove this generated hunk; keep documentation in backend/drive/drive.go.
backend/drive/drive.go Adds acknowledgment to download URLs. Moderate (2 votes): Add focused HTTP tests. Moderate (1 vote): Prevent the retry from duplicating the query parameter.
Review details

Suppressed comments (2)

backend/drive/drive.go:4415

  • The initial request already passes through withAcknowledgeAbuse, so this retry appends the parameter a second time and sends acknowledgeAbuse=true&acknowledgeAbuse=true. Keep the existing URL for the retry (or make the helper idempotent) so the fallback does not emit duplicate query parameters.
				url = withAcknowledgeAbuse(url)

docs/content/drive.md:1099

  • This file is generated from backend option Help fields; repository guidance says not to commit make backenddocs output. Please keep this documentation change in backend/drive/drive.go and drop this generated hunk, otherwise it will be overwritten on the next doc generation.
With this flag set rclone sends acknowledgeAbuse=true on every download.
Google otherwise holds each download of an executable for ~30s to scan it
for malware on every request, so this also makes those downloads fast.
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread backend/drive/drive.go
Comment on lines +4405 to +4408
if o.fs.opt.AcknowledgeAbuse {
// Send it up front: Google otherwise holds every download of an
// executable for ~30s to scan it for malware on each request.
url = withAcknowledgeAbuse(url)
@Masterxilo

Copy link
Copy Markdown
Author

fixes are trivial, let copilot do them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants