Skip to content

[HotFix]: Fix base address and blob uri decoding mismatch #10429

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

Merged
merged 2 commits into from
Apr 28, 2025

Conversation

erdembayar
Copy link
Contributor

@erdembayar erdembayar commented Apr 28, 2025

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 the catalog2dnx 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
image
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

@erdembayar erdembayar requested a review from a team as a code owner April 28, 2025 16:48
"https://contoso.blob.core.windows.net/v3-flatcontainer/пакет123/",
"https://contoso.blob.core.windows.net/v3-flatcontainer/%D0%BF%D0%B0%D0%BA%D0%B5%D1%82123/2.1.0/пакет123.nuspec",
"2.1.0/пакет123.nuspec")]
public void GetName_EncodedAndDecodedUnicodeUris_ReturnsCorrectName(string baseAddressString, string uriString, string expectedName)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regardless of whether the base address and blob URI have different encoding, it always returns the correct decoded name

@erdembayar erdembayar merged commit 6d81efd into main Apr 28, 2025
2 checks passed
JPGrieb pushed a commit to JPGrieb/NuGetGallery that referenced this pull request Jun 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants