Repository navigation
Fix ArgumentOutOfRangeException in DownloadFromResultsContainer when link has no query - #17704
Conversation
|
/azp run arcade-pr |
|
Commenter does not have sufficient privileges for PR 17704 in repo dotnet/arcade |
|
@austinaviv Can you check and see whether this needs resolution in the job monitor too? |
Sure, I'll check the Job Monitor code for the same URI parsing issue and verify whether it can encounter blob URLs without query parameters. If the same issue exists, I'll add the corresponding fix and tests. Thanks for your review |
|
I investigated Job Monitor. In AzureBlobClientFactory, line 20 already had a blobUri.Contains('?') check so bare URLs without query strings did not throw an exception there. However, it was using LastIndexOf('?') rather than IndexOf('?') and did not trim leading ? characters from SAS tokens before passing them to AzureSasCredential. I pushed an update aligning AzureBlobClientFactory with the same safe URI and SAS token parsing logic, along with unit test coverage in AzureBlobClientFactoryTests. |
|
Hi @mmitche, just checking in on this when you have a moment. All CI checks are passing, and the Job Monitor adjustments along with unit tests are in place. Please let me know if there is anything else needed. |
|
/backport to release/10.0 |
|
/backport to release/11.0 |
|
Started backporting to |
|
Started backporting to |
|
@premun backporting to git am output$ git cherry-pick ea982189bb40e0f9bae13e31f3fd1db4c5c8283c
Auto-merging src/Microsoft.DotNet.Helix/Sdk/DownloadFromResultsContainer.cs
CONFLICT (content): Merge conflict in src/Microsoft.DotNet.Helix/Sdk/DownloadFromResultsContainer.cs
error: could not apply ea982189b... Fix ArgumentOutOfRangeException in DownloadFromResultsContainer when link has no query (#17704)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Fix URI query stripping in DownloadFromResultsContainer
.git/rebase-apply/patch:127: trailing whitespace.
if (string.IsNullOrEmpty(sasToken))
warning: 1 line adds whitespace errors.
Using index info to reconstruct a base tree...
M src/Microsoft.DotNet.Helix/Sdk/DownloadFromResultsContainer.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Microsoft.DotNet.Helix/Sdk/DownloadFromResultsContainer.cs
CONFLICT (content): Merge conflict in src/Microsoft.DotNet.Helix/Sdk/DownloadFromResultsContainer.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Fix URI query stripping in DownloadFromResultsContainer
Error: The process '/usr/bin/git' failed with exit code 128 |
|
@premun backporting to git am output$ git cherry-pick ea982189bb40e0f9bae13e31f3fd1db4c5c8283c
Auto-merging src/Microsoft.DotNet.Helix/Sdk/DownloadFromResultsContainer.cs
CONFLICT (content): Merge conflict in src/Microsoft.DotNet.Helix/Sdk/DownloadFromResultsContainer.cs
error: could not apply ea982189b... Fix ArgumentOutOfRangeException in DownloadFromResultsContainer when link has no query (#17704)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Fix URI query stripping in DownloadFromResultsContainer
.git/rebase-apply/patch:127: trailing whitespace.
if (string.IsNullOrEmpty(sasToken))
warning: 1 line adds whitespace errors.
Using index info to reconstruct a base tree...
M src/Microsoft.DotNet.Helix/Sdk/DownloadFromResultsContainer.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Microsoft.DotNet.Helix/Sdk/DownloadFromResultsContainer.cs
CONFLICT (content): Merge conflict in src/Microsoft.DotNet.Helix/Sdk/DownloadFromResultsContainer.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Fix URI query stripping in DownloadFromResultsContainer
Error: The process '/usr/bin/git' failed with exit code 128 |
Fixes #17703
Description
When DownloadFromResultsContainer downloads work item results using a read SAS token from resultsUri.ResultsUriRSAS, it was unconditionally calling fileAvailableForDownload.Link.Substring(0, fileAvailableForDownload.Link.LastIndexOf('?')). If the file link is a bare blob URI without query parameters, LastIndexOf('?') returns -1 and causes Substring(0, -1) to throw an unhandled ArgumentOutOfRangeException.
Changes