[HotFix]: Fix base address and blob uri decoding mismatch #10429
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix https://github.com/NuGet/Engineering/issues/5850
Follow up on #10410 (comment)
Previously #10417 fixed double encoding problem for blob name for
db2catalog
job, but thecatalog2dnx
job was getting miscalculated length blob name because the base address was still encoded while the blob URI was decoded. Now, we decode/unescape both of them to avoid such mismatches.Added matrix unit tests ensure that, regardless of whether the base address or blob URI have the same or mismatched encoding, we can still get the correct blob name.
We leverage the fact that .GetLeftPart doesn't encode characters that are already encoded, although this behavior is not documented dotnet/dotnet-api-docs#11254
Tested on

dev
deployment:Unicode package: https://dev.nugettest.org/packages/%E9%82%AE%E4%BB%B63/1.1.0
https://apidev.nugettest.org/v3-flatcontainer/%E9%82%AE%E4%BB%B63/index.json
https://nugetdev0.blob.core.windows.net/v3-flatcontainer/test2.avaloni%CE%B1123/2.1.0/test2.avaloni%CE%B1123.nuspec