Opened 4 years ago

Closed 4 years ago

#17555 closed Bug (fixed)

LocaleMiddleware wrongly redirects paths without trailing slash

Reported by: Tuttle Owned by: nobody
Component: Internationalization Version: master
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 Tuttle 4 years ago.
17555.diff (2.4 KB) - added by gabooo 4 years ago.
Tests added
17555.v2.diff (2.4 KB) - added by neaf 4 years ago.
Update tests to avoid using override_settings

Download all attachments as: .zip

Change History (9)

Changed 4 years ago by Tuttle

comment:1 in reply to: ↑ description Changed 4 years ago by Tuttle

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Replying to Tuttle:

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

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

comment:2 Changed 4 years ago by ramiro

  • Needs tests set

comment:3 Changed 4 years ago by Tuttle

  • Version changed from 1.3 to SVN

Changed 4 years ago by gabooo

Tests added

comment:4 Changed 4 years ago by gabooo

  • Needs tests unset
  • Triage Stage changed from Unreviewed to Accepted

Changed 4 years ago by neaf

Update tests to avoid using override_settings

comment:5 Changed 4 years ago by lpiatek

  • Triage Stage changed from Accepted to Ready for checkin

comment:6 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

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