#31330: Trailing slash is missing in a "catchall" pattern in flatpages URLconf
example.
-------------------------------------+-------------------------------------
Reporter: meesterguyman | Owner: Hasan
| Ramezani
Type: Bug | Status: new
Component: Documentation | Version: 3.0
Severity: Normal | Resolution:
Keywords: append_slash, | Triage Stage: Accepted
flatpage, catchall |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by bodgerbarnett):
* status: closed => new
* resolution: fixed =>
Comment:
I think the addition of the slash causes a different problem.
Any valid page URL will match the catch all pattern, but the actual URL
that is captured will not have the last slash in it. This will cause the
flatpages view code to fail to find the page, add a slash to the URL and
then return a permanent redirect to that URL with an extra slash on the
end of it. So if the URL is '/someurl/', the user will be redirected to
'/someurl//'.
I think the last slash needs to be inside the captured part of the URL,
which can be done with re_path, like this:-
{{{
re_path('^(?P<url>.+/)$', views.flatpage)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31330#comment:12>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/071.797e6024369026619541f9b8b737b164%40djangoproject.com.