Code that parses bugtracker urls need to handle urls with no protocol specified

Bug #117452 reported by Diogo Matsubara
12
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Medium
Eleanor Berger

Bug Description

Steps to reproduce (using sample data):
1. Open http://bugs.launchpad.dev/firefox/+bug/1/
2. Click also affects Upstream link
3. Enter in Project: 'thunderbird'
4. Click Continue
5. Enter in URL: bugzilla.gnome.org/show_bug.cgi?id=1
6. Click Indicate bug in Mozilla Thunderbird
7. ValueError: list.remove(x): x not in list (OOPS-510E797)

Changed in malone:
importance: Undecided → Medium
status: Unconfirmed → Confirmed
Revision history for this message
Christian Reis (kiko) wrote :

I can do this if somebody tells me if we should try tacking on http:// to the front of the URL, or if we should raise a validation error.

Revision history for this message
Graham Binns (gmb) wrote :

The simplest way to handle this is to prepend http:// to the URL and tell the user that we've done that once the tracker has been registered. That way they can always change the protocol if it's wrong by editing the tracker (bug #135524 notwithstanding).

The nicest way to do this would be to add the protocol and then offer the user the option to change it before the tracker is added to the database, but as has been pointed out that would be fiddly at best and we don't really have a facility for doing it.

Revision history for this message
Eleanor Berger (intellectronica) wrote :

Perhaps the best general solution is to simply try to match the input against the list of currently registered bug trackers (we could probably do this as part of ensureBugTracker).

- If the scheme is omitted but the bugtracker is already registered, we'll find it.
- If more than the scheme is omitted (say, the TLD, or the most specific sub-domain) we'll find it.

I'm not sure it makes sense to attempt creating a new bug tracker based on guesswork if it's not already there, since we'll be inviting users to create lots of false bug trackers, but if we do want that,we could still add http:// as a default, after trying to match.

Changed in malone:
assignee: nobody → intellectronica
Changed in malone:
status: Confirmed → In Progress
Revision history for this message
Eleanor Berger (intellectronica) wrote :

After discussing this with ~jsk, the solution decided upon is pretty much as proposed above:

1. Fix the oops by handling the case where the user entered an invalid URL (with missing schema, for example) when trying the different permutations.
2. If we find a substring match, we propose it to the user and ask them to confirm.
3. If we don't find a match, we add `http://` to the user's input and ask them to confirm.

Revision history for this message
Christian Reis (kiko) wrote : Re: [Bug 117452] Re: Code that parses bugtracker urls need to handle urls with no protocol specified

Looks good to go. Do it!

Revision history for this message
Eleanor Berger (intellectronica) wrote :

The extra confirmation step will not be done, as suggested by ~BjornT - this is a pretty rare corner case, so it's probably not worth spending time on it now.

Revision history for this message
Eleanor Berger (intellectronica) wrote :

pending review

Changed in malone:
status: In Progress → Fix Committed
Changed in malone:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.