-
-
Notifications
You must be signed in to change notification settings - Fork 197
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
Allow link in attribution #806
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of minor comments added inline. Please add tests cases. Thanks for the contribution!
cmd/internal/register/maps.go
Outdated
newMap.Attribution = html.EscapeString(string(cfg.Attribution)) | ||
|
||
attribution := html.EscapeString(string(cfg.Attribution)) | ||
re := regexp.MustCompile(`<(a\s(.+?)|/a)>`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the regexp.MustCompile outside the function call.
cmd/internal/register/maps.go
Outdated
attribution := html.EscapeString(string(cfg.Attribution)) | ||
re := regexp.MustCompile(`<(a\s(.+?)|/a)>`) | ||
tags := re.FindAllString(attribution, -1) | ||
for _, tag := range tags { | ||
attribution = strings.Replace(attribution, tag, html.UnescapeString(tag), 1) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could move this to a separate function and maybe call it sanitizeAttribution
. That would allow you to add your test cases to the codebase which would be ideal.
Please review the new commits |
@underspica this looks excellent! Thanks for making the adjustments. The last request is to squash everything into a single commit then I will get this merged in. Thank you! |
Allow link in attribution Test SanitizeAttribution
Done, thank you. |
Issue #798
Allow link in attribution by unescape anchor tag.