From 6f2bbd991fb885228702b960b17000fe2fc40567 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 7 Sep 2016 00:27:19 +0200 Subject: [PATCH] better URL completion --- src/shpub/Validator.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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; -- 2.30.2