Flyspray - The bug killer!

  • Status Waiting on Customer
  • Percent Complete
    50%
  • Task Type Bug Report
  • Category Notifications → Email
  • Assigned To
    peterdd
  • Operating System All
  • Severity Low
  • Priority Very Low
  • Reported Version 1.0-rc9
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Flyspray - The bug killer!
Opened by Christian Wörstenfeld - 14.03.2020
Last edited by peterdd - 26.03.2020

FS#2596 - Invalid link in notification HTML part of eMail

Hello,
my notification eMails have invalid links.

I use a different port. See below for the partial eMail source text:

DIES IST EINE AUTOMATISCH ERSTELLTE NACHRICHT, BITTE NICHT ANTWORTEN.<br>
… <br>Mehr Informationen k=C3=B6nnen unter=
der folgenden URL abgerufen werden: <br><a href=3D”https://pp.cobru.de“>pp=
.cobru.de</a>:444/bug/index.php?do=3Ddetails&task_id=3D309<br><br>Sie erhal=
ten diese Nachricht, weil Sie in Flyspray Benachrichtigungen aktiviert habe=

Debian GNU/Linux 10 (buster)
MySQL 10.3.22
PHP version: 7.3.14-1~deb10u1
Flyspray 1.0-rc9

Steps done to create the problem:
-Use a different Webserver Port
-Enable eMail notifications
-Create or modify an task

Expected behavior:
-Valid link

Experienced behavior:
-Invalid link

BR
Wörsty

Project Manager

The reason seems a failing link detection because an optional port in a url is not recognized by the pattern matching that creates the html a-tag of the HTML part of a notification email. Email readers that prefer displaying the plain text part instead HTML part are not effected.

Could you try replacing the regular expression in includes/class.notify.php (around currently at line 416, see https://github.com/Flyspray/flyspray/blob/master/includes/class.notify.php#L416)

Replace this:

// Make plaintext URLs into hyperlinks, but don't disturb existing ones!
$htmlbody = preg_replace("/(?<!\")(https?:\/\/)([a-zA-Z0-9\-.]+\.[a-zA-Z0-9\-]+([\/]([a-zA-Z0-9_\/\-.?&%=+#])*)*)/", '<a href="$1$2">$2</a>', $body);

with this:

// Make plaintext URLs into hyperlinks, but don't disturb existing ones!
$htmlbody = preg_replace("/(?<!\")(https?:\/\/)([a-z0-9\-.]+\.[a-z0-9\-]+(:[0-9]+)?([\/]([a-z0-9_\/\-.?&%=+#])*)*)/i", '<a href="$1$2">$2</a>', $body);

The resulting regular expression is still not perfect but should handle now optional ports. I fiddled a bit with https://regex101.com/ - really cool project.

Project Manager

I made a change on github. Please test.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing