jenkins-bot has submitted this change and it was merged.

Change subject: (bug 48302) Trailing dot in link is ignored in plain text email
......................................................................


(bug 48302) Trailing dot in link is ignored in plain text email

A random link may contain trailing dot and it doesn't get linked

Change-Id: Ia7d3a4a437438ba473c24b3f4f98bb133cd52954
---
M Echo.i18n.php
M formatters/BasicFormatter.php
2 files changed, 13 insertions(+), 4 deletions(-)

Approvals:
  Kaldari: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Echo.i18n.php b/Echo.i18n.php
index 853d792..6e296b5 100644
--- a/Echo.i18n.php
+++ b/Echo.i18n.php
@@ -83,7 +83,7 @@
 
 View more:
 
-$2
+<$2>
 
 $4',
        'notification-edit-talk-page-email-batch-body2' => '$1 
{{GENDER:$1|posted}} on your talk page',
@@ -103,7 +103,7 @@
 
 View more:
 
-$3
+<$3>
 
 $6',
        'notification-reverted-email-batch-body2' => 'Your {{PLURAL:$3|edit on 
$2 was|edits on $2 were}} {{GENDER:$1|reverted}} by $1',
@@ -114,7 +114,7 @@
 
 View more:
 
-$4
+<$4>
 
 $5',
        'notification-mention-email-batch-body' => '$1 {{GENDER:$1|mentioned}} 
you on $2',
diff --git a/formatters/BasicFormatter.php b/formatters/BasicFormatter.php
index 84ec03d..007cf44 100644
--- a/formatters/BasicFormatter.php
+++ b/formatters/BasicFormatter.php
@@ -350,7 +350,16 @@
 
                        $message->rawParams( Linker::link( $title, $linkText, 
$class, $param ) );
                } elseif ( $this->outputFormat === 'email' ) {
-                       $message->params( $title->getCanonicalURL( $param ) );
+                       // plain text email in some mail client is ignoring 
trailing
+                       // dot in links, it is better to encode the last 
character
+                       $url = $title->getCanonicalURL( $param );
+                       // $url should contain all ascii characters now, it's 
safe to use substr()
+                       $lastChar = substr( $url, -1 );
+                       if ( $lastChar && !ctype_alnum( $lastChar ) ) {
+                               $lastChar = str_replace( array( '.', '-' ), 
array( '%2E', '%2D' ), urlencode( $lastChar ) );
+                               $url = substr( $url, 0, -1 ) . $lastChar;
+                       }
+                       $message->params( $url );
                } else {
                        $message->params( $title->getFullURL( $param ) );
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/63007
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia7d3a4a437438ba473c24b3f4f98bb133cd52954
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
Gerrit-Reviewer: Bsitu <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: Lwelling <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to