Merge lp://qastaging/~daker/webbrowser-app/fix.1317428 into lp://qastaging/webbrowser-app

Proposed by Adnane Belmadiaf
Status: Needs review
Proposed branch: lp://qastaging/~daker/webbrowser-app/fix.1317428
Merge into: lp://qastaging/webbrowser-app
Diff against target: 48 lines (+21/-15)
1 file modified
src/app/AddressBar.qml (+21/-15)
To merge this branch: bzr merge lp://qastaging/~daker/webbrowser-app/fix.1317428
Reviewer Review Type Date Requested Status
Ubuntu Phablet Team Pending
Review via email: mp+225759@code.qastaging.launchpad.net

Description of the change

Unfortunately the regexp doesn't work all the time with the QML JS interpreter

QML :

OK : http://gmail.com
NO : http://m.facebook.com
OK : http://www.google.com
NO : http://www.fb.com
OK : https://facebook.com
NO : http://guh.guru:8080
OK : http://userid:<email address hidden>:8080
NO : http://<email address hidden>
OK : http://192.168.1.1/
NO : http://machine.local
OK : http://192.168.1.1:8080/
NO : www fff
NO : facebook

Chrome/Firefox JS interpreter

OK : http://gmail.com
OK : http://m.facebook.com
OK : http://www.google.com
OK : http://www.fb.com
OK : https://facebook.com
OK : http://guh.guru:8080
OK : http://userid:<email address hidden>:8080
OK : http://<email address hidden>
OK : http://192.168.1.1/
OK : http://machine.local
OK : http://192.168.1.1:8080/
NO : www fff
NO : facebook

To post a comment you must log in.
608. By Adnane Belmadiaf

Validate only hostnames with allowed characters according to RFC 3986

Revision history for this message
Olivier Tilloy (osomon) wrote :

11 + if (invalid_hostname_characters.match(address)){
12 + return false
13 + }

It doesn’t seem correct to me to apply the invalid_hostname_characters RE to the entire address: you’d want to apply it to the host part only. But since we don’t really know whether address is a valid URl yet, there’s no easy way to extract the host part. So I’m not sure this makes sense.

Revision history for this message
Olivier Tilloy (osomon) wrote :

If we really want to be strict about URL validation, I think we shouldn’t reinvent the wheel. QUrl provides us everything we need to parse a URL from a string and check whether it’s valid. Unfortunately it’s not exposed to QML (the url type in QML doesn’t match our needs), so we’d need to expose a C++ helper to QML to validate a given URL.

Unmerged revisions

608. By Adnane Belmadiaf

Validate only hostnames with allowed characters according to RFC 3986

607. By Adnane Belmadiaf

Added a new regex for URL validation

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to status/vote changes: