Web url regexp matches non url

Bug #948086 reported by Angelo Compagnucci on 2012-03-06
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Unity
Fix Released
Undecided
Unassigned
unity-lens-files
Wishlist
Angelo Compagnucci
unity (Ubuntu)
Undecided
Unassigned
unity-lens-files (Ubuntu)
Undecided
Unassigned

Bug Description

Current regexp:

web_regex = new Regex ("([a-zA-Z0-9\\-]+\\...+|http[s]{0,1}://.+)");

matches against non urls, like "daemon.vala". It needs to validate TLDs to be effective.

Related branches

Michal Hruby (mhr3) on 2012-03-07
Changed in unity-lens-files:
status: New → In Progress
assignee: nobody → Angelo Compagnucci (angelo-compagnucci)
importance: Undecided → Wishlist
Changed in unity-lens-files:
status: In Progress → Fix Committed

daemon.vala is a valid url if we disregard the fact that it doesn't have a scheme.

Changed in unity-lens-files:
status: Fix Committed → In Progress
milestone: none → 5.8.0

The thing is that spec-compliant URL validation is in fact somewhat of a tricky business, and as it stands glib doesn't provide any helpers for it. That is why we included the overly simplified matching in the first case.

Moreso, http://foo is, in fact, a valid URL. For instance on many company intranets you can access the public webserver on 'http://www'.

So what I am trying to say is: we should forget about strict URL validation and look for stuff regular people are likely to type (or paste in) when they want to access a website.

Michal Hruby (mhr3) wrote :

Yes, daemon.vala is a valid url, so is report.doc, and since this is implemented in the files lens, the idea was that we should be more strict as to what is considered a url query and what is a file.

The matching currently is far from spec-compliant and it does allow stuff like http://www, so I don't really see a problem, can we close this again?

Michal Hruby (mhr3) on 2012-03-23
Changed in unity-lens-files:
status: In Progress → Fix Committed
Changed in unity:
status: New → Fix Committed
Didier Roche (didrocks) on 2012-03-23
Changed in unity:
milestone: none → 5.8.0
Didier Roche (didrocks) on 2012-03-23
Changed in unity:
status: Fix Committed → Fix Released
Changed in unity-lens-files:
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity-lens-files - 5.8.0-0ubuntu1

---------------
unity-lens-files (5.8.0-0ubuntu1) precise-proposed; urgency=low

  * New upstream release.
    - clicking on folders in the file lens does not open nautilus
      (LP: #921665)
    - Dash - No message displayed when no results are returned in the
      Dash (LP: #711199)
    - Privacy Delete history is not deleting download history (LP: #947856)
    - Locate scope doesn't respect privacy settings (LP: #955229)
    - \\192.168.1.x opens http:\\192.168.1.x in firefox as opposed to
      smb://192.168.1.x in nautilus (LP: #773841)
    - Web url regexp matches non url (LP: #948086)
  * debian/control:
    - build-dep on newer zeitgeist
 -- Didier Roche <email address hidden> Fri, 23 Mar 2012 15:05:24 +0100

Changed in unity-lens-files (Ubuntu):
status: New → Fix Released
Changed in unity (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers