Fixed #36447 -- Selected preferred media type based on quality.

When matching which entry in the `Accept` header should be used for
a given media type, the specificity matters. However once those are
resolved, only the quality matters when selecting preference.

Regression in c075508b4d.

Thank you to Anders Kaseorg for the report.
This commit is contained in:
Jake Howard 2025-06-10 23:00:25 +01:00 committed by Sarah Boyce
parent 8e2249bc79
commit 12c1557060
4 changed files with 94 additions and 9 deletions

View file

@ -478,7 +478,7 @@ Methods
None
(For further details on how content negotiation is performed, see
:rfc:`7231#section-5.3.2`.)
:rfc:`9110#section-12.5.1`.)
Most browsers send ``Accept: */*`` by default, meaning they don't have a
preference, in which case the first item in ``media_types`` would be

View file

@ -9,4 +9,6 @@ Django 5.2.4 fixes several bugs in 5.2.3.
Bugfixes
========
* ...
* Fixed a regression in Django 5.2.2 where :meth:`HttpRequest.get_preferred_type()
<django.http.HttpRequest.get_preferred_type>` incorrectly preferred more
specific media types with a lower quality (:ticket:`36447`).