We need to return a user-friendly message when someone tries to register a branch with a invalid URL.

Bug #52780 reported by Diogo Matsubara
2
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
James Henstridge

Bug Description

We need to return a user-friendly message when someone tries to register a branch with a invalid URL.
We're currently raising an AssertionError.

OOPS-192D57

Changed in launchpad-bazaar:
importance: Untriaged → Medium
status: Unconfirmed → Confirmed
Revision history for this message
Christian Reis (kiko) wrote :

How do you know what the branch URL was, from that oops?

Revision history for this message
Diogo Matsubara (matsubara) wrote :

I don't know the URL that was passed (for that we need to fix bug 44872). What I can see in that OOPS is that when you register a branch via xmlrpc you end up calling IBranchSet.getByURL() to check if that URL is already registered. If the URL isn't valid the AssertionError is raised.

David Allouche (ddaa)
Changed in launchpad-bazaar:
importance: Medium → High
assignee: nobody → jamesh
Revision history for this message
James Henstridge (jamesh) wrote :

The XML-RPC interface now strips slashes from the end of the URL.

Changed in launchpad-bazaar:
status: Confirmed → Fix Committed
Revision history for this message
James Henstridge (jamesh) wrote :

fix included in today's rollout

Changed in launchpad-bazaar:
status: Fix Committed → Fix Released
Revision history for this message
Jonathan Lange (jml) wrote :
Download full text (3.4 KiB)

I don't think this bug can be considered to be fixed.

See the following (admittedly silly) example:

jml@rhino:~/Code/Joybot/test-registration$ bzr register-branch .
launchpad.net password for <email address hidden>:
bzr: ERROR: xmlrpclib.Fault: <Fault -1: 'Unexpected Zope exception: IntegrityError: ERROR: new row for relation "branch" violates check constraint "valid_url"\n\n/*46912670684944*/ INSERT INTO Branch (id, current_conflicts_url, mirror_failures, mirror_request_time, current_delta_url, last_mirrored, lifecycle_status, product, landing_target, current_activity, last_scanned_id, title, home_page, home_page_locked, name, revision_count, last_mirrored_id, current_diff_deletes, mirror_status_message, owner, pull_disabled, cache_url, last_scanned, started_at, url, stats_updated, whiteboard, summary, branch_home_page, author, last_mirror_attempt, current_diff_adds, product_locked, branch_product_name) VALUES (2888, NULL, 0, NULL, NULL, NULL, 1, NULL, NULL, 0, NULL, NULL, NULL, \'f\', \'.\', 0, NULL, NULL, NULL, 567070, \'f\', NULL, NULL, NULL, \'.\', NULL, NULL, NULL, NULL, 567070, NULL, NULL, \'f\', NULL)'>

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 650, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 612, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 304, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad/__init__.py", line 111, in run
    branch_object_url = rego.submit(service)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad/lp_registration.py", line 140, in submit
    return service.send_request(self._methodname, self._request_params())
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad/lp_registration.py", line 107, in send_request
    result = method(*method_params)
  File "xmlrpclib.py", line 1147, in __call__
    return self.__send(self.__name, args)
  File "xmlrpclib.py", line 1437, in __request
    verbose=self.__verbose
  File "xmlrpclib.py", line 1201, in request
    return self._parse_response(h.getfile(), sock)
  File "xmlrpclib.py", line 1340, in _parse_response
    return u.close()
  File "xmlrpclib.py", line 787, in close
    raise Fault(**self._stack[0])
Fault: <Fault -1: 'Unexpected Zope exception: IntegrityError: ERROR: new row for relation "branch" violates check constraint "valid_url"\n\n/*46912670684944*/ INSERT INTO Branch (id, current_conflicts_url, mirror_failures, mirror_request_time, current_delta_url, last_mirrored, lifecycle_status, product, landing_target, current_activity, last_scanned_id, title, home_page, home_page_locked, name, revision_count, last_mirrored_id, current_diff_deletes, mirror_status_message, owner, pull_disabled, cache_url, last_scanned, started_at, url, stats_updated, whiteboard, summary, branch_home_page, author, last_mirror_attempt, current_diff_adds, product_locked, branch_product_name) VALUES (2888, NULL, 0, NULL, NULL, NULL, 1, NULL, NULL, 0, NULL, NULL, NULL, \'f\', \'.\', ...

Read more...

Changed in launchpad-bazaar:
status: Fix Released → Unconfirmed
Revision history for this message
James Henstridge (jamesh) wrote :

We should probably see if we can use the existing field validator to handle the branch URL. This should allow us to provide the same error messages as the web UI provides without having two bits of code to update in the future.

Furthermore, we should see if we can do something to not send unexpected tracebacks to users. Probably another place to use OOPS codes.

Changed in launchpad-bazaar:
status: Unconfirmed → Confirmed
Revision history for this message
David Allouche (ddaa) wrote :

We are already using the existing URL validator for the xmlrpc interface.

Changed in launchpad-bazaar:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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