[Django] #35627: LocaleMiddleware: 'lang_code' exceeds the maximum accepted length

40 views
Skip to first unread message

Django

unread,
Jul 23, 2024, 4:47:01 AM7/23/24
to django-...@googlegroups.com
#35627: LocaleMiddleware: 'lang_code' exceeds the maximum accepted length
------------------------------+-----------------------------------------
Reporter: Lorenzo Peña | Type: Uncategorized
Status: new | Component: Uncategorized
Version: 5.0 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+-----------------------------------------
Try any Django powered site where LocaleMiddleware is enanled and visit
domain.com/aaaaaaaaaaa.... (where there are 1000 'a').
This line kicks in:
https://github.com/django/django/blob/main/django/utils/translation/trans_real.py#L520

I think the outcome should be a 404 instead of raising ValueError all the
way up.
--
Ticket URL: <https://code.djangoproject.com/ticket/35627>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 23, 2024, 4:52:44 AM7/23/24
to django-...@googlegroups.com
#35627: LocaleMiddleware: 'lang_code' exceeds the maximum accepted length
-------------------------------+----------------------------------------
Reporter: Lorenzo Peña | Owner: Lorenzo Peña
Type: Uncategorized | Status: assigned
Component: Uncategorized | Version: 5.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+----------------------------------------
Changes (by Lorenzo Peña):

* owner: (none) => Lorenzo Peña
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/35627#comment:1>

Django

unread,
Jul 23, 2024, 5:11:45 AM7/23/24
to django-...@googlegroups.com
#35627: LocaleMiddleware: 'lang_code' exceeds the maximum accepted length
-------------------------------+----------------------------------------
Reporter: Lorenzo Peña | Owner: Lorenzo Peña
Type: Uncategorized | Status: assigned
Component: Uncategorized | Version: 5.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+----------------------------------------
Changes (by Lorenzo Peña):

* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/35627#comment:2>

Django

unread,
Jul 23, 2024, 5:46:24 AM7/23/24
to django-...@googlegroups.com
#35627: LocaleMiddleware: 'lang_code' exceeds the maximum accepted length
-------------------------------------+-------------------------------------
Reporter: Lorenzo Peña | Owner: Lorenzo
| Peña
Type: Bug | Status: assigned
Component: | Version: 5.0
Internationalization |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* component: Uncategorized => Internationalization
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted
* type: Uncategorized => Bug

Comment:

Regression in 9e9792228a6bb5d6402a5d645bc3be4cf364aefb
Perhaps we should raise a LookupError rather than a ValueError, I believe
this needs backporting to 4.2, 5.0, 5.1
--
Ticket URL: <https://code.djangoproject.com/ticket/35627#comment:3>

Django

unread,
Jul 23, 2024, 6:12:22 AM7/23/24
to django-...@googlegroups.com
#35627: LocaleMiddleware: 'lang_code' exceeds the maximum accepted length
-------------------------------------+-------------------------------------
Reporter: Lorenzo Peña | Owner: Lorenzo
| Peña
Type: Bug | Status: assigned
Component: | Version: 5.0
Internationalization |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Lorenzo Peña):

I'd be happy to break the ice with Django contributions with this one, if
possible. In the PR I am catching both ValueError and LookupError in the
callers. I am happy to also raise LookupError instead and not modify
anything else.
--
Ticket URL: <https://code.djangoproject.com/ticket/35627#comment:4>

Django

unread,
Jul 23, 2024, 6:13:15 AM7/23/24
to django-...@googlegroups.com
#35627: LocaleMiddleware: 'lang_code' exceeds the maximum accepted length
-------------------------------------+-------------------------------------
Reporter: Lorenzo Peña | Owner: Lorenzo
| Peña
Type: Bug | Status: assigned
Component: | Version: 5.0
Internationalization |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Lorenzo Peña):

https://github.com/django/django/pull/18403
--
Ticket URL: <https://code.djangoproject.com/ticket/35627#comment:5>
Reply all
Reply to author
Forward
0 new messages