-
Notifications
You must be signed in to change notification settings - Fork 911
Fix RenameSource URL encoding for paths with special characters #24680
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: tanyasethi-msft <[email protected]>
Co-authored-by: tanyasethi-msft <[email protected]>
Co-authored-by: tanyasethi-msft <[email protected]>
Co-authored-by: tanyasethi-msft <[email protected]>
Write tests for testing the above fix |
Lint error - |
Co-authored-by: tanyasethi-msft <[email protected]>
I've added comprehensive tests for the RenameSource URL encoding fix:
The tests verify that paths with spaces, Unicode characters, and other special characters are properly encoded when used in the RenameSource header. Commit: 5c98ccf |
Co-authored-by: tanyasethi-msft <[email protected]>
Fixed the gocritic lint error by replacing |
Lint errors -
No changes needed in internal folder. |
Co-authored-by: tanyasethi-msft <[email protected]>
Fixed the lint errors by removing the unused import of |
file/client_test.go:1: : # github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/file_test [github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/file.test] |
remove file models_test.go in internal folder. |
Co-authored-by: tanyasethi-msft <[email protected]>
Fixed the lint errors in file/client_test.go:
These changes resolve all the reported lint errors. Commit: a8e859c |
Summary
This PR fixes an issue where file or directory paths containing special characters would cause a 400 error when used as the source path in rename operations.
Issue
When renaming files or directories in Azure Data Lake Storage, paths with special characters (like spaces, Unicode characters, etc.) would fail with a 400 error because the source path wasn't properly URL-encoded before being used in the RenameSource header.
For example, when attempting to rename a file with a path like
dir1/lör 006.jpg
, the request would fail with:Solution
Modified
FormatRenameOptions
ininternal/path/models.go
to properly handle URL encoding:runtime.EncodeQueryParams
function to correctly encode any query parametersThis approach ensures that:
Impact
This fix affects both the file client and directory client rename operations since they both use the same underlying
FormatRenameOptions
function. The changes are minimal and focused only on the encoding logic.Fixes #23831.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.