savannah-hackers-public
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Savannah-hackers-public] too many http://'s


From: Sergey Poznyakoff
Subject: Re: [Savannah-hackers-public] too many http://'s
Date: Mon, 04 Jul 2016 18:41:01 +0300

Hi Karl,

> Sergey, does this happen on puszcza?

Yes, it does.  Please find attached a patch.

Best regards,
Sergey

>From 72d0512c0da96bcb6422994665ecf859e53f6ca3 Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <address@hidden>
Date: Mon, 4 Jul 2016 18:33:32 +0300
Subject: [PATCH] Bugfix in markup processing code

* frontend/php/include/markup.php (_markup_inline): Prefix 'www.' with
http:// only if it sits at a word boundary.
---
 frontend/php/include/markup.php | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/frontend/php/include/markup.php b/frontend/php/include/markup.php
index 618b4b6..41d17c9 100644
--- a/frontend/php/include/markup.php
+++ b/frontend/php/include/markup.php
@@ -631,11 +631,10 @@ function _markup_inline($line)
   # we can expect web browsers to support)
   $protocols = "https?|ftp|sftp|file|afs|nfs|ircs?";

-
   # Prepare usual links: prefix every "www." with "http://";
   # unless there is a // before
-  $line = preg_replace('/(^|\s|[^\/])(www\.)/i', '$1http://$2', $line);
-
+  $line = preg_replace('/\b(www\.)/i', 'http://$1', $line);
+
   # replace the @ sign with an HTML entity, if it is used within
   # an url (e.g. for pointers to mailing lists). This way, the
   # @ sign doesn't get mangled in the e-mail markup code
--
1.8.3.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]