raise RuntimeError((""
"You called this URL via POST, but the URL doesn't end "
"in a slash and you have APPEND_SLASH set. Django can't "
"redirect to the slash URL while maintaining POST data. "
"Change your form to point to %s%s (note the trailing "
"slash), or set APPEND_SLASH=False in your Django "
"settings.") % (new_url[0], new_url[1]))
was extended to PUT and PATCH requests. PUT and PATCH requests have
associated data which is generally lost with a redirect.
Code:
https://github.com/django/django/blob/1.7.2/django/middleware/common.py#L75
--
Ticket URL: <https://code.djangoproject.com/ticket/24145>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: tom@… (added)
* needs_better_patch: => 0
* component: contrib.redirects => Core (Other)
* needs_tests: => 0
* easy: 0 => 1
* needs_docs: => 0
* type: New feature => Bug
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/24145#comment:1>
Comment (by tomchristie):
I'm going to second this one. Our options are:
* Extend the check to also include `PUT` and `PATCH` and continue issuing
the 500 response.
* Extend the check to also include `PUT` and `PATCH`, but use an 307 (or
308) redirect, which is spec'ed as not allowing a rewrite-to-GET request.
See: http://trac.tools.ietf.org/html/draft-ietf-
httpbis-p2-semantics-21#section-7.4.7
Of these, the first is the lesser change. It's unclear to me how widely
supported 307/308 responses are supported by browsers and other clients.
--
Ticket URL: <https://code.djangoproject.com/ticket/24145#comment:2>
Comment (by samuelcolvin):
Since it was easy I took the chance to try and get myself on the list of
django contributors: https://github.com/django/django/pull/3908
--
Ticket URL: <https://code.djangoproject.com/ticket/24145#comment:3>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/24145#comment:4>
Comment (by arcturusannamalai):
@samuelcolvin please assign this geck to yourself. It is seems to have a
solution you had developed, but looks as if it is not triaged.
--
Ticket URL: <https://code.djangoproject.com/ticket/24145#comment:5>
* status: new => assigned
* owner: nobody => samuelcolvin
--
Ticket URL: <https://code.djangoproject.com/ticket/24145#comment:6>
* stage: Accepted => Ready for checkin
Comment:
[https://github.com/django/django/pull/3908/ PR #3908] LGTM.
--
Ticket URL: <https://code.djangoproject.com/ticket/24145#comment:7>
* needs_tests: 0 => 1
* stage: Ready for checkin => Accepted
Comment:
I think some tests wouldn't hurt here (not sure if there's one for the
existing behavior).
--
Ticket URL: <https://code.djangoproject.com/ticket/24145#comment:8>
* needs_tests: 1 => 0
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/24145#comment:9>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"5b74134f27eabf92870e1c5e81f9e4999f113eab"]:
{{{
#!CommitTicketReference repository=""
revision="5b74134f27eabf92870e1c5e81f9e4999f113eab"
Fixed #24145 -- Added PUT & PATCH to CommonMiddleware APPEND_SLASH
redirect error.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24145#comment:10>