8000 drive: fixed the issue where Google Docs file name was truncated, causing panic or unparseable characters by jaycee88 · Pull Request #8573 · rclone/rclone · GitHub
[go: up one dir, main page]

Skip to content

drive: fixed the issue where Google Docs file name was truncated, causing panic or unparseable characters #8573

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jaycee88
Copy link
@jaycee88 jaycee88 commented May 27, 2025

What is the purpose of this change?

When downloading Google documents, the remote does not contain the suffix, and the extension is '.docx'. The code here will cause panic or the file name will be truncated (if the file name is Chinese or Japanese, there will be unparseable characters)

9f7df015cbd14d1f07ae0f6b60ea02bf
86a48ca000ff88e2d611e171d2f1efe5

Was the change discussed in an issue or in the forum before?

Checklist

  • I have read the contribution guidelines.
  • 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.
  • I'm done, this Pull Request is ready for review :-)

@jaycee88 jaycee88 changed the title Fixed the issue where Google Docs file name was truncated, causing panic or unparseable characters drive: fixed the issue where Google Docs file name was truncated, causing panic or unparseable characters May 27, 2025
Copy link
Member
@ncw ncw left a comment

Choose a reason for hiding this comment

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

I'm not 100% sure this is the correct fix. Your code looks good but I think remote should always have extension - see inline.

How do you replicate this? Can you give me step by step instructions please :-)

Thank you.

@@ -1495,7 +1495,7 @@ func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error) {
return nil, err 8000
}

remote = remote[:len(remote)-len(extension)]
remote = strings.TrimSuffix(remote, extension)
Copy link
Member

Choose a reason for hiding this comment

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

I think this must be a bug in f.getRemoteInfoWithExport(ctx, remote) - why is it returning extension if remote doesn't have extension?

…sing panic or unparseable characters

When downloading Google documents, the remote does not contain the suffix, and the extension is '.docx'. The code here will cause panic or the file name will be truncated (if the file name is Chinese or Japanese, there will be unparseable characters)
@jaycee88
Copy link
Author

I'm not 100% sure this is the correct fix. Your code looks good but I think remote should always have extension - see inline.

How do you replicate this? Can you give me step by step instructions please :-)

Thank you.

Sorry, it turns out the issue was caused by our modification to the list behavior. In our version, the listed Google Docs use the original file name without appending the .docx extension. However, in the native rclone implementation, Google Docs are listed with the .docx extension appended, which avoids the error.

@ncw
Copy link
Member
ncw commented May 29, 2025

Ah that makes sense.

Do you want to merge this anyway? It seems like good defensive programming.

@jaycee88
Copy link
Author

Ah that makes sense.

Do you want to merge this anyway? It seems like good defensive programming.

Yes, I think it would be better to merge this.

Thank you.

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
0