﻿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
19594	urlpatterns not respected for trailling slashed when mod_rewrite is on	francisl	nobody	"'django.core.handlers.base.get_script_name' behaves strangely when extra slashes are added at the end of a URL and FORCE_SCRIPT_NAME is not set.

The returned value will repeat the URL if extra slashes is added.
This will lead to a 404
If there is a regex explicitly accepting extra slashes, it will be ignored
This condition is not the expected behavior, but there is also no reason to return an erroneous response and to prevent the resolver to do its work

e.g. :

Requested /api/news//?key=value
Returns //api/news/

Requested /api/news///?key=value
Returns /a/api/news 

The ""/a"" is the URL starting to repeat itself.


How to reproduce:
Run django with wsgi, apache and mod_rewrite on
Request urls with extra ending slashes

Workaround:
Set FORCE_SCRIPT_NAME = """" in the settings.
Since FORCE_SCRIPT_NAME isn't defaulted, it can lead to confusion and make this strange behavior hard to debug.

Solution:
Don’t add the SCRIPT_URL to the PATH_INFO if FORCE_SCRIPT_NAME is not set. See patch.txt

This also affect django to 1.5"	Bug	closed	Core (Other)	1.3	Normal	invalid	mod_rewrite urlpatterns	DevEquipeWeb@…	Unreviewed	1	0	0	0	0	0
