Skip to content

Commit 818936e

Browse files
committed
Better normalisation of links for comparison
1 parent 605b9be commit 818936e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plugins/IMAPLinkDestinationRevealer.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def edit_message(self, byte_message):
3131

3232
href_url = link_prefix + link_url
3333
text_url = b'http' + link_text
34-
if href_url not in [text_url, b'%s/' % text_url, text_url.rstrip(b'/')]:
34+
if self.normalise_url(href_url) != self.normalise_url(text_url):
3535
parts = link_url.split(b'/', 1)
3636
truncated = b'%s%s' % (link_prefix, parts[0])
3737
if len(parts) > 0:
@@ -55,3 +55,7 @@ def edit_message(self, byte_message):
5555
else:
5656
# no links to replace (or potentially some encoding not handled by IMAPMessageEditor)
5757
return byte_message
58+
59+
@staticmethod
60+
def normalise_url(url):
61+
return url.rstrip(b'/').replace(b'&', b'&')

0 commit comments

Comments
 (0)