From: Christian Weiske Date: Tue, 6 Sep 2016 22:27:19 +0000 (+0200) Subject: better URL completion X-Git-Tag: v0.0.1~6 X-Git-Url: https://git.cweiske.de/shpub.git/commitdiff_plain/6f2bbd991fb885228702b960b17000fe2fc40567 better URL completion --- diff --git a/src/shpub/Validator.php b/src/shpub/Validator.php index f7f3605..1da91cb 100644 --- a/src/shpub/Validator.php +++ b/src/shpub/Validator.php @@ -16,8 +16,14 @@ class Validator } if (!isset($parts['host'])) { - Log::err('Invalid URL: No host in ' . $helpName); - return false; + if (count($parts) == 1 && isset($parts['path'])) { + //parse_url('example.org') puts 'example.org' in the path + // but this is common, so we fix it. + $url = 'http://' . $parts['path']; + } else { + Log::err('Invalid URL: No host in ' . $helpName); + return false; + } } return $url;