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

Fixed ImageDomainValidator for GitHub URLs #8646

Merged
merged 1 commit into from
Jun 24, 2021
Merged

Conversation

nils-a
Copy link
Contributor

@nils-a nils-a commented Jun 19, 2021

by adding the missing /actions/ segment into the URL regex
GithubBadgeUrlRegEx.

Addresses #8645

@@ -13,7 +13,7 @@ namespace NuGetGallery
public class ImageDomainValidator: IImageDomainValidator
{
private static readonly TimeSpan RegexTimeout = TimeSpan.FromMinutes(1);
private static readonly Regex GithubBadgeUrlRegEx = new Regex("^(https|http):\\/\\/github\\.com\\/[^/]+\\/[^/]+\\/workflows\\/.*badge\\.svg", RegexOptions.IgnoreCase, RegexTimeout);
private static readonly Regex GithubBadgeUrlRegEx = new Regex("^(https|http):\\/\\/github\\.com\\/[^/]+\\/[^/]+\\/actions\\/workflows\\/.*badge\\.svg", RegexOptions.IgnoreCase, RegexTimeout);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we change to actions to be optional, like (/actions/)?

Suggested change
private static readonly Regex GithubBadgeUrlRegEx = new Regex("^(https|http):\\/\\/github\\.com\\/[^/]+\\/[^/]+\\/actions\\/workflows\\/.*badge\\.svg", RegexOptions.IgnoreCase, RegexTimeout);
private static readonly Regex GithubBadgeUrlRegEx = new Regex("^(https|http):\/\/github\.com\/[^/]+\/[^/]+\/(actions\/)?workflows\/.*badge\.svg", RegexOptions.IgnoreCase, RegexTimeout);

by adding the missing `/actions/` segment into the URL regex
`GithubBadgeUrlRegEx`.
@nils-a
Copy link
Contributor Author

nils-a commented Jun 24, 2021

@lyndaidaii I modified the expression accordingly.

@lyndaidaii
Copy link
Contributor

@nils-a, thank you for great contribution. awesome work, all look good to me.

@lyndaidaii lyndaidaii merged commit 935525c into NuGet:dev Jun 24, 2021
@nils-a nils-a deleted the nils-a-8645 branch June 24, 2021 22:03
@dannyjdev dannyjdev mentioned this pull request Jun 29, 2021
5 tasks
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