We should consistently ensure bugtracker URLs are slash-terminated (or not)

Bug #1434 reported by Christian Reis
20
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Low
Christian Reis

Bug Description

Because they can cause problems when generating links manually, we should consistently ensure bugtracker URLs are slash-terminated (or perhaps we decide they should consistently not be slash-terminated -- either is fine by me).

When this is fixed, the code in BugWatch.url() can be changed to take this into account.

Tags: lp-bugs
Revision history for this message
Steve Alexander (stevea) wrote :

What do you mean by "generating links manually" ?

Is the idea that a bugwatch URL will always have things added to the end of it? If so, let's make it always end in a slash.

As a note for the future: there's a URL class in the menus code that we can use more generally. It provides an API for doing things with URLs like getting a version of the URL that always ends in a slash.

Revision history for this message
Christian Reis (kiko) wrote :

Well, bugwatch.py:BugWatch does string manipulation to generate URLs to remote bugs. And yes, the bugwatch URL will have bits added to its end, so it makes sense to make it always end in a slash.

Would it be better to use this URL class now, then?

Revision history for this message
Steve Alexander (stevea) wrote :

Taking into account all the comments, I think we should ensure that the URLs always end in a slash, and that this will be documented in the appropriate interfaces and doctests.

Revision history for this message
Matthew Paul Thomas (mpt) wrote :

I'd prefer that they always *not* have a slash, for brevity and easier typing. Requiring a slash wouldn't have prevented bug 1479, and it may not even work for some bug trackers.

Brad Bollenbach (bradb)
Changed in malone:
assignee: nobody → bradb
status: New → Accepted
Christian Reis (kiko)
Changed in malone:
assignee: bradb → kiko
Revision history for this message
Christian Reis (kiko) wrote :

Actually, using urlparse.urljoin avoids the whole nonsense about validating URL termination -- enter it any way you like and it always works.

Changed in malone:
status: Confirmed → Fix Committed
Revision history for this message
Björn Tillenius (bjornt) wrote : Re: [Bug 1434] Re: We should consistently ensure bugtracker URLs are slash-terminated (or not)

On Sat, Apr 08, 2006 at 03:51:27PM -0000, Christian Reis wrote:
> Actually, using urlparse.urljoin avoids the whole nonsense about
> validating URL termination -- enter it any way you like and it always
> works.

urljoin won't help here. It makes a huge difference if the URL ends
with a slash or not.

    >>> urlparse.urljoin('http://foo.com/bar', 'baz')
    'http://foo.com/baz'

    >>> urlparse.urljoin('http://foo.com/bar/', 'baz')
    'http://foo.com/bar/baz'

    status confirmed

Changed in malone:
status: Fix Committed → Confirmed
Revision history for this message
Christian Reis (kiko) wrote :

Sorry -- yeah, you're right. Fixed to use helpers.urlappend, and included more specific tests now.

Changed in malone:
status: Confirmed → In Progress
Christian Reis (kiko)
Changed in malone:
status: In Progress → Fix Committed
Christian Reis (kiko)
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.