Opened 14 years ago

Last modified 14 years ago

#52 closed defect (FIXED)

Ignore trailing slash in most URLs

Reported by: Aaron Williamson Owned by:
Priority: minor Milestone:
Component: Keywords:
Cc: Parent Tickets:

Description

We should treat ``/u/aaron/`` the same as ``/u/aaron`` rather than
returning a 404. (Should this be true of URLs ending in a file
extension or not?)



Change History (4)

comment:1 by Sebastian Spaeth, 14 years ago

Yes we should. And this is something that should not be solved in
the individual url patterns, but on a framework level, IMHO. Django
has some "Always append trailing slash" option and patterns can
them assume a trailing slash.

I think we should do the same, Either always append a trailing
slash or always cut it off before handing the URL to the
URL matcher. Is there a downside to this?



comment:2 by Christopher Allan Webber, 14 years ago

Status: NewClosed
Fixed, see
`https://gitorious.org/mediagoblin/mediagoblin/commit/7222955fbad9d21542e71dafa910973a9cb0e676 <https://gitorious.org/mediagoblin/mediagoblin/commit/7222955fbad9d21542e71dafa910973a9cb0e676>`_

So Sebastian Spaeth, may be useful for you to know in the future:
we do support trailing slash appending just like in django actually
already, but the way it works is that you have to have the URL in
your routes end in /. Then if you visit it **without** the / at the
end, it adds it (which is the way django does it also). We should
try and have our URLs always end in / unless it makes sense to do
otherwise probably.

Anyway, good catch, thanks! :)



comment:3 by Aaron Williamson, 14 years ago

Thanks for the fix/info, Christopher. Maybe we need a coding
standards wiki for information like this?



comment:4 by Will Kahn-Greene, 13 years ago

The original url for this bug was http://bugs.foocorp.net/issues/326 .

Note: See TracTickets for help on using tickets.