[Bug 690] New: String.isUrl() allows invalid URLs

View: New views
4 Messages — Rating Filter:   Alert me  

[Bug 690] New: String.isUrl() allows invalid URLs

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://dev.helma.org/bugs/show_bug.cgi?id=690

           Summary: String.isUrl() allows invalid URLs
           Product: Helma
           Version: CVS trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: helmaLib, helmaTools
        AssignedTo: helma-dev@...
        ReportedBy: philipp.naderer@...


http://<ishoudfail>asdf.com will be a valid URL, but Helma will just return
"http://asdf.com". After creating the URL in the try-block, it should not
return the java.net.URL, but rather a boolean true or false. So the last
"return true" is unreachable code.

Also String.URLPATTERN is not very fine grained.

String.prototype.isUrl = function() {
if (String.URLPATTERN.test(this))
   return true;
   try {
      return new java.net.URL(this);
   } catch (err) {
      return false;
   }
   return true;
};

--
Configure bugmail: http://dev.helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 690] String.isUrl() allows invalid URLs

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://dev.helma.org/bugs/show_bug.cgi?id=690





--- Comment #1 from Philipp <philipp.naderer@...>  2009-11-04 14:00:56 ---
Typo! http://<ishoudfail>asdf.com will be a valid URL --> will be an INVALID
URL.

--
Configure bugmail: http://dev.helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 690] String.isUrl() allows invalid URLs

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://dev.helma.org/bugs/show_bug.cgi?id=690





--- Comment #2 from Philipp <philipp.naderer@...>  2009-11-06 12:58:54 ---
There is a loooong Regex in the Antville-Trunk, which is taken from the jQuery
Validation Plugin. The author took the URL-RFC and parsed it into this regex.

http://code.google.com/p/antville/source/browse/trunk/code/Global/Global.js#63

--
Configure bugmail: http://dev.helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 690] String.isUrl() allows invalid URLs

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://dev.helma.org/bugs/show_bug.cgi?id=690





--- Comment #3 from Philipp <philipp.naderer@...>  2009-11-22 09:50:42 ---
Apache Commons provides a validator for URL and E-Mail. This would be a quick
and clean fix for both.

http://commons.apache.org/validator/apidocs/org/apache/commons/validator/routines/package-summary.html#package_description

--
Configure bugmail: http://dev.helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev