﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31330	"Trailing slash is missing in a ""catchall"" pattern in flatpages URLconf example."	Bryant Glisson	Hasan Ramezani	"We would like to append slashes to all URLs that do not have them, and we would also like to have a catchall flatpage expression, so our editors can enter whatever they like in that area of the CMS. The problem is that the flatpage validator adds the slash, but then only checks to see if a Flatpage exists for the resultant path (https://github.com/django/django/blob/master/django/contrib/flatpages/views.py#L41), whereas the is_valid_path method (https://github.com/django/django/blob/b9cf764be62e77b4777b3a75ec256f6209a57671/django/urls/base.py#L150) checks the urlconf, of which the catchall is a part, returns True, because the non-slash url fits the catchall. Hence, it does not redirect to the slashed version, making it impossible to reach and resulting in a 404.

Again, here is the flow:
1. Attempt to reach ""/my-valid-page-without-a-slash""
2. is_valid_path returns True because ""/my-valid-page-without-a-slash"" fits the flatpage catchall and hence does not append a slash
3. The page is not found in Flatpage entries, resulting in 404

It seems to me that if APPEND_SLASH is set to True, then we should not be looking in the urlconf for the page without the slash, but should instead immediately append the slash, then check the urlconf, in which case the correct pattern would be found and flatpages would never be called.



"	Bug	closed	Documentation	3.0	Normal	fixed	append_slash, flatpage, catchall		Ready for checkin	1	0	0	0	1	0
