-
Couldn't load subscription status.
- Fork 5.1k
[Storage][DataMovement] Fixed potential incorrect resource names for upload transfers #52491
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
[Storage][DataMovement] Fixed potential incorrect resource names for upload transfers #52491
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue where upload transfers could produce incorrect resource names when a path with a trailing directory separator is passed to LocalFilesStorageResourceProvider.FromDirectory. The fix ensures consistent path handling by trimming trailing separators in the LocalDirectoryStorageResourceContainer constructor.
Key Changes
- Trimmed trailing directory separators in
LocalDirectoryStorageResourceContainerconstructor - Refactored path computation logic in
TransferJobInternalto use a centralized helper method - Added comprehensive test coverage for trailing slash scenarios
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/storage/Azure.Storage.DataMovement/src/LocalDirectoryStorageResourceContainer.cs | Added path trimming logic to constructor |
| sdk/storage/Azure.Storage.DataMovement/src/TransferJobInternal.cs | Refactored path computation into helper method |
| sdk/storage/Azure.Storage.DataMovement/tests/LocalDirectoryStorageResourceTests.cs | Updated tests to verify trimming behavior |
| sdk/storage/Azure.Storage.DataMovement/tests/Shared/StartTransferUploadDirectoryTestBase.cs | Added test for upload with trailing slash |
| sdk/storage/Azure.Storage.DataMovement/tests/Shared/StartTransferDirectoryDownloadTestBase.cs | Added test for download with trailing slash |
| sdk/storage/Azure.Storage.DataMovement/tests/Shared/TransferValidator.Local.cs | Added path trimming for consistency |
| sdk/storage/Azure.Storage.DataMovement.Blobs/tests/BlobContainerClientExtensionsTests.cs | Fixed test to use trimmed paths |
| Multiple CHANGELOG.md files | Added bug fix entry |
| Multiple assets.json files | Updated asset tags |
|
/azp run net - storage - datamovement - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Test failures are known or flakey. Will override |
|
/check-enforcer override |
…upload transfers (Azure#52491)
There was an issue where if a path with a trailing path separator was passed to
LocalFilesStorageResourceProvider.FromDirectoryduring an upload transfer, the destination resource names may be missing the first character. This was because some path parsing logic assumed the path did not end with a trailing separator. This fixes the issue by always trimming the end of the path when constructingLocalDirectoryStorageResourceContainer.Also added another change in
TransferJobInternalto harden the logic during enumeration for the same case. While either change would address the issue, this should harden against future issues or missed cases.