Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Added extra fix, improved upload test
  • Loading branch information
jalauzon-msft committed Sep 9, 2025
commit 01228bda7ee54aa9ca237cb702c429f6be3a489d
2 changes: 1 addition & 1 deletion sdk/storage/Azure.Storage.DataMovement.Blobs/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/storage/Azure.Storage.DataMovement.Blobs",
"Tag": "net/storage/Azure.Storage.DataMovement.Blobs_2f44fdf50b"
"Tag": "net/storage/Azure.Storage.DataMovement.Blobs_c2f1f2fc3f"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/storage/Azure.Storage.DataMovement.Files.Shares",
"Tag": "net/storage/Azure.Storage.DataMovement.Files.Shares_df34cc0ab7"
"Tag": "net/storage/Azure.Storage.DataMovement.Files.Shares_c847746677"
}
24 changes: 13 additions & 11 deletions sdk/storage/Azure.Storage.DataMovement/src/TransferJobInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,13 +329,7 @@ private async IAsyncEnumerable<JobPartInternal> EnumerateAndCreateJobPartsAsync(

if (current.IsContainer)
{
// Create sub-container
string containerUriPath = _sourceResourceContainer.Uri.GetPath();
string subContainerPath = string.IsNullOrEmpty(containerUriPath)
? current.Uri.GetPath()
: current.Uri.GetPath().Substring(containerUriPath.Length + 1);
// Decode the container name as it was pulled from encoded Uri and will be re-encoded on destination.
subContainerPath = Uri.UnescapeDataString(subContainerPath);
string subContainerPath = GetChildResourcePath(_sourceResourceContainer, current);
StorageResourceContainer subContainer =
_destinationResourceContainer.GetChildStorageResourceContainer(subContainerPath);

Expand Down Expand Up @@ -370,10 +364,7 @@ private async IAsyncEnumerable<JobPartInternal> EnumerateAndCreateJobPartsAsync(
// Real container trasnfer
else
{
string containerUriPath = _sourceResourceContainer.Uri.GetPath();
sourceName = current.Uri.GetPath().Substring(containerUriPath.Length + 1);
// Decode the resource name as it was pulled from encoded Uri and will be re-encoded on destination.
sourceName = Uri.UnescapeDataString(sourceName);
sourceName = GetChildResourcePath(_sourceResourceContainer, current);
}

StorageResourceItem sourceItem = (StorageResourceItem)current;
Expand Down Expand Up @@ -654,5 +645,16 @@ internal async ValueTask IncrementJobParts()
{
await _progressTracker.IncrementQueuedFilesAsync(_cancellationToken).ConfigureAwait(false);
}

private static string GetChildResourcePath(StorageResourceContainer parent, StorageResource child)
{
string parentPath = parent.Uri.GetPath();
string childPath = child.Uri.GetPath().Substring(parentPath.Length);
// If container path does not contain a '/' (normal case), then childPath will have one after substring.
// Safe to use / here as we are using AbsolutePath which normalizes to /.
childPath = childPath.TrimStart('/');
// Decode the resource name as it was pulled from encoded Uri and will be re-encoded on destination.
return Uri.UnescapeDataString(childPath);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -530,11 +530,7 @@ public async Task Upload_TrailingSlash()
using DisposingLocalDirectory disposingLocalDirectory = DisposingLocalDirectory.GetTestDirectory();
await using IDisposingContainer<TContainerClient> test = await GetDisposingContainerAsync();

List<string> files =
[
GetNewObjectName(),
GetNewObjectName(),
];
List<string> files = [ "file1", "file2", "dir1/file1" ];

CancellationToken cancellationToken = TestHelper.GetTimeoutToken(30);
await SetupDirectoryAsync(
Expand Down
Loading