From 6a6584741f3d91bff2461421ef220b2bcae7847d Mon Sep 17 00:00:00 2001
From: Brion Vibber <brion@pobox.com>
Date: Fri, 25 Feb 2011 15:46:35 -0800
Subject: [PATCH] Fix for ticket #2248: flickr etc URLs that contain @ in the
 paths etc no longer accidentally trip the mailto: thingy

---
 lib/util.php | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/util.php b/lib/util.php
index 85f49e4c59..8dd22de592 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -922,11 +922,11 @@ function common_linkify($url) {
     // functions
     $url = htmlspecialchars_decode($url);
 
-   if(strpos($url, '@') !== false && strpos($url, ':') === false) {
-       //url is an email address without the mailto: protocol
-       $canon = "mailto:$url";
-       $longurl = "mailto:$url";
-   }else{
+    if (strpos($url, '@') !== false && strpos($url, ':') === false && Validate::email($url)) {
+        //url is an email address without the mailto: protocol
+        $canon = "mailto:$url";
+        $longurl = "mailto:$url";
+    } else {
 
         $canon = File_redirection::_canonUrl($url);
 
-- 
2.39.5