Opened 12 years ago

Closed 12 years ago

#17555 closed Bug (fixed)

LocaleMiddleware wrongly redirects paths without trailing slash

Reported by: Vlada Macek Owned by: nobody
Component: Internationalization Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

On requests with path like '/en', the translation.get_language_from_path() does a bad redirection to, say, '/cs/en' in case the browser asks for Czech language.

I think the language-code detection regexp should respect ending slash-less paths.
Patch attached.

Attachments (3)

language-code-prefix-ending.patch (529 bytes ) - added by Vlada Macek 12 years ago.
17555.diff (2.4 KB ) - added by gabooo 12 years ago.
Tests added
17555.v2.diff (2.4 KB ) - added by neaf 12 years ago.
Update tests to avoid using override_settings

Download all attachments as: .zip

Change History (9)

by Vlada Macek, 12 years ago

in reply to:  description comment:1 by Vlada Macek, 12 years ago

Replying to Tuttle:

... translation.get_language_from_path() does a bad redirection...

It causes it, not that it does it, of course.

comment:2 by Ramiro Morales, 12 years ago

Needs tests: set

comment:3 by Vlada Macek, 12 years ago

Version: 1.3SVN

by gabooo, 12 years ago

Attachment: 17555.diff added

Tests added

comment:4 by gabooo, 12 years ago

Needs tests: unset
Triage Stage: UnreviewedAccepted

by neaf, 12 years ago

Attachment: 17555.v2.diff added

Update tests to avoid using override_settings

comment:5 by lpiatek, 12 years ago

Triage Stage: AcceptedReady for checkin

comment:6 by Jannis Leidel, 12 years ago

Resolution: fixed
Status: newclosed

In [17443]:

Fixed #17555 -- Added support for a missing trailing slash when redirecting based on the browser language. Thanks, neaf.

Note: See TracTickets for help on using tickets.
Back to Top