Skip to content

Conversation

@jalauzon-msft
Copy link
Member

@jalauzon-msft jalauzon-msft commented Sep 5, 2025

There was an issue where if a path with a trailing path separator was passed to LocalFilesStorageResourceProvider.FromDirectory during 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 constructing LocalDirectoryStorageResourceContainer.

Also added another change in TransferJobInternal to 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.

@github-actions github-actions bot added the Storage Storage Service (Queues, Blobs, Files) label Sep 5, 2025
@jalauzon-msft jalauzon-msft marked this pull request as ready for review September 9, 2025 21:42
Copilot AI review requested due to automatic review settings September 9, 2025 21:42
Copy link
Contributor

Copilot AI left a 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 LocalDirectoryStorageResourceContainer constructor
  • Refactored path computation logic in TransferJobInternal to 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

@jalauzon-msft
Copy link
Member Author

/azp run net - storage - datamovement - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jalauzon-msft
Copy link
Member Author

Test failures are known or flakey. Will override

@jalauzon-msft
Copy link
Member Author

/check-enforcer override

@jalauzon-msft jalauzon-msft merged commit 8ca5872 into Azure:main Sep 10, 2025
24 of 32 checks passed
@jalauzon-msft jalauzon-msft deleted the dmlib-trailing-slash-bug branch September 10, 2025 00:15
jalauzon-msft added a commit to jalauzon-msft/azure-sdk-for-net that referenced this pull request Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] [Storage] [DataMovement] Local folder uploaded to Blob target contains extra subfolder

2 participants