-
Notifications
You must be signed in to change notification settings - Fork 102
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
For HTML messages, add HTML tags to all URIs in message footer/header text #1916
base: main
Are you sure you want to change the base?
Conversation
…ssage footer/header text, so links are clickable when text is appended to HTML messages
@@ -63,6 +63,8 @@ use Sympa::Tools::Password; | |||
use Sympa::Tools::SMIME; | |||
use Sympa::Tools::Text; | |||
use Sympa::User; | |||
use CGI; | |||
use URI::Find::Schemeless; |
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.
URI::Find::Schemeless should also be added to the cpanfile
file on the top of source tree as a requires
section.
$footer_msg = Sympa::Tools::Text::encode_html($footer_msg); | ||
$footer_msg = uri_finder($footer_msg); |
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.
HTML encoding (escaping) should be done only in uri_finder()
below, i.e. Sympa::Tools::Text::encode_html()
in above line should be removed. Or escaping will duplicate (and URIs including &
will not be detected properly).
The same is true for $header_msg
and $global_footer_msg
.
my($uri, $orig_uri) = @_; | ||
return qq|<a href="$uri">$orig_uri</a>|; | ||
}); | ||
$finder->find(\$text, \&CGI::escapeHTML); |
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.
Use Sympa::Tools::Text::escape_html()
instead of CGI::encodeHTML()
. The reason is simply that Sympa consistently uses the former.
$finder->find(\$text, \&CGI::escapeHTML); | ||
|
||
# and finally clean up the displayed link text on mailto links: | ||
$text =~ s/>mailto:/>/g; |
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.
I personally think that this “mailto:
” is included in the original text and may not be removed.
Use URI::Find::Schemeless to add HTML tags around all URIs in message footer/header text, so links are clickable when text is appended to HTML messages. No effect on plaintext messages.