@anonymous-piwik-user opened this Issue on May 27th 2008

I'm working on my project which uses Piwik.

Call:
http://megliosoft.dyndns.org:4958/pwtransl/?module=API&method=SitesManager.addSite&siteName=r9&urls=http://megliosoft.dyndns.org:4958/books/abc.html&token_auth=....

Error:
<?xml version="1.0" encoding="utf-8" ?><result> <error message="The url 'http://megliosoft.dyndns.org:4958/bijouterie/ab.html' is not a valid URL." /></result>

@anonymous-piwik-user commented on May 27th 2008

I researched little on this bug and I found that the problem is in
API.php:static private function isValidUrl( $url )

I fixed it temporarily on my local Piwik copy this way:

static private function isValidUrl( $url )
    {
        $pattern = "/^((https?|ftp|gopher|telnet|file|wais):\/\/)"  
        . "(([A-z0-9_]+):([A-z0-9-_]*)@)?"  
        . "(([A-z0-9_-]+\.)*)"  
        . "(([A-z0-9-]{2,})\.)"  
        . "([A-z]{2,})"  
        . "(:(\d+))?"  
        . "((\/[a-z0-9-_.%~]*)*)?"  
        . "(\?[^? ]*)?$/";
        return preg_match($pattern, $url);
}

Against your coding agreements you may want to move pattern definition to some comment.

Please let me know whether this solution works for you.

Thanks,
Anton

@mattab commented on May 29th 2008 Owner

(In [495]) - fix #5653, now allowing URLs with port

This Issue was closed on May 29th 2008
Powered by GitHub Issue Mirror