better URL completion
[shpub.git] / src / shpub / Validator.php
index f7f3605d103b999cfee3a314fdd4e48a0922958d..1da91cb390775b5f751efada1d8abb6f00dd8a81 100644 (file)
@@ -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;