Skip to content
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

modify pettry link #8658

Merged
merged 3 commits into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
2 changes: 1 addition & 1 deletion src/NuGetGallery/Helpers/HtmlExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void appendUrl(StringBuilder builder, string inputText)
// Format links to NuGet packages
Match packageMatch = RegexEx.MatchWithTimeoutOrNull(
formattedUri,
$@"({Regex.Escape(siteRoot)}\/packages\/(?<name>\w+([_.-]\w+)*(\/[0-9a-zA-Z-.]+)?)\/?$)",
$@"(^{Regex.Escape(siteRoot)}\/packages\/(?<name>\w+([_.-]\w+)*(\/[0-9a-zA-Z-.]+)?)\/?$)",
RegexOptions.IgnoreCase);
if (packageMatch != null && packageMatch.Groups["name"].Success)
{
Expand Down
4 changes: 4 additions & 0 deletions tests/NuGetGallery.Facts/Helpers/HtmlExtensionsFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ public void ConvertsUrlsToLinks(string input, string expected)
[InlineData("My package is https://www.nuget.org/packages/WindowsAzure.Storage/9.3.1-preview.7", "My package is <a href=\"https://www.nuget.org/packages/WindowsAzure.Storage/9.3.1-preview.7\" rel=\"nofollow\">WindowsAzure.Storage/9.3.1-preview.7</a>")]
[InlineData("My package is https://www.nuget.org/packages/WindowsAzure.Storage/9.3.1/.", "My package is <a href=\"https://www.nuget.org/packages/WindowsAzure.Storage/9.3.1/\" rel=\"nofollow\">WindowsAzure.Storage/9.3.1</a>.")]
[InlineData("My package is https://nuget.org/packages/WindowsAzure.Storage/9.3.1/.", "My package is <a href=\"https://nuget.org/packages/WindowsAzure.Storage/9.3.1/\" rel=\"nofollow\">https://nuget.org/packages/WindowsAzure.Storage/9.3.1/</a>.")]
[InlineData("My package is https://www.microsoft.com#https://nuget.org/packages/WindowsAzure.Storage/9.3.1/.", "My package is <a href=\"https://www.microsoft.com/#https://nuget.org/packages/WindowsAzure.Storage/9.3.1/\" rel=\"nofollow\">https://www.microsoft.com/#https://nuget.org/packages/WindowsAzure.Storage/9.3.1/</a>.")]
[InlineData("My package is http://www.microsoft.com#https://nuget.org/packages/WindowsAzure.Storage/9.3.1/.", "My package is <a href=\"https://www.microsoft.com/#https://nuget.org/packages/WindowsAzure.Storage/9.3.1/\" rel=\"nofollow\">https://www.microsoft.com/#https://nuget.org/packages/WindowsAzure.Storage/9.3.1/</a>.")]
[InlineData("My package is https://www.microsoft.com##https://nuget.org/packages/WindowsAzure.Storage/9.3.1/.", "My package is <a href=\"https://www.microsoft.com/##https://nuget.org/packages/WindowsAzure.Storage/9.3.1/\" rel=\"nofollow\">https://www.microsoft.com/##https://nuget.org/packages/WindowsAzure.Storage/9.3.1/</a>.")]
[InlineData("My package is https://www.nuget.org#https://nuget.org/packages/WindowsAzure.Storage/9.3.1/.", "My package is <a href=\"https://www.nuget.org/#https://nuget.org/packages/WindowsAzure.Storage/9.3.1/\" rel=\"nofollow\">https://www.nuget.org/#https://nuget.org/packages/WindowsAzure.Storage/9.3.1/</a>.")]
public void ConvertsPackageUrlsToLinksWithShortText(string input, string expected)
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps I am misunderstanding, but shouldn't these newly added tests be on ConvertsUrlsToLinks since the short text isn't being used?

{
// Arrange
Expand Down