Skip to content

Commit

Permalink
fix: unescape in URLs which are stored for tracking
Browse files Browse the repository at this point in the history
closes #2568
closes #907
closes #115
  • Loading branch information
adamcooke committed Mar 4, 2024
1 parent 658aa71 commit 1da1182
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/postal/message_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ def insert_links(part, type = nil)
part.gsub!(/href=(['"])(#{URL_REGEX})['"]/) do
if track_domain?($~[:domain])
@tracked_links += 1
token = @message.create_link($~[:url])
url = CGI.unescapeHTML($~[:url])
token = @message.create_link(url)
"href='#{domain}/#{@message.server.token}/#{token}'"
else
::Regexp.last_match(0)
Expand Down
2 changes: 1 addition & 1 deletion script/send_html_email.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<p>Hello there</p>
<p>This is an example email. It doesn't do all that much.</p>
<p>Some other characters: őúéáűí</p>
<p>There is a <a href='https://postalserver.io/test-plain-text-link?foo=bar&baz=qux'>link here</a> though...</p>
<p>There is a <a href='https://postalserver.io/test-plain-text-link?foo=bar&amp;baz=qux'>link here</a> though...</p>
BODY
end

Expand Down

0 comments on commit 1da1182

Please sign in to comment.