From 1cc9e7db0f2b22b66820fd392e6684b43267ba43 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Sun, 22 Mar 2015 10:53:24 +0100 Subject: [PATCH 1/2] Add scheme if missing to url inserted by user in 'insert link' jot button --- mod/parse_url.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mod/parse_url.php b/mod/parse_url.php index cd2263dbe..8920878a8 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -407,6 +407,15 @@ function parse_url_content(&$a) { } } + // add url scheme if missing + $arrurl = parse_url($url); + if (!x($arrurl, 'scheme')) { + if (x($arrurl, 'host')) + $url = "http:".$url; + else + $url = "http://".$url; + } + logger('parse_url: ' . $url); if($textmode) @@ -464,7 +473,7 @@ function parse_url_content(&$a) { if($siteinfo["title"] == "") { $sitedata .= sprintf($template,$url,$url,'') . $str_tags; - killme(); + #killme(); } else { $text = $siteinfo["text"]; $title = $siteinfo["title"]; From 250b466ed38b25c0dccf93d30cec8202d41f0b6f Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Sun, 22 Mar 2015 11:03:46 +0100 Subject: [PATCH 2/2] Fix blank reponse if no siteinfo are fetched --- mod/parse_url.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mod/parse_url.php b/mod/parse_url.php index 8920878a8..7f4bd29a0 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -471,10 +471,7 @@ function parse_url_content(&$a) { $sitedata = ""; - if($siteinfo["title"] == "") { - $sitedata .= sprintf($template,$url,$url,'') . $str_tags; - #killme(); - } else { + if($siteinfo["title"] != "") { $text = $siteinfo["text"]; $title = $siteinfo["title"]; }