Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
f46a838e
Kaydet (Commit)
f46a838e
authored
Kas 06, 2016
tarafından
Sven Engström
Kaydeden (comit)
Tim Graham
Kas 06, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #26812 -- Fixed APPEND_SLASH on a URL including querystring with a trailing slash.
üst
29563cfb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
common.py
django/middleware/common.py
+1
-1
tests.py
tests/middleware/tests.py
+12
-0
No files found.
django/middleware/common.py
Dosyayı görüntüle @
f46a838e
...
...
@@ -74,7 +74,7 @@ class CommonMiddleware(MiddlewareMixin):
Return True if settings.APPEND_SLASH is True and appending a slash to
the request path turns an invalid path into a valid one.
"""
if
settings
.
APPEND_SLASH
and
not
request
.
get_full_path
()
.
endswith
(
'/'
):
if
settings
.
APPEND_SLASH
and
not
request
.
path_info
.
endswith
(
'/'
):
urlconf
=
getattr
(
request
,
'urlconf'
,
None
)
return
(
not
is_valid_path
(
request
.
path_info
,
urlconf
)
and
...
...
tests/middleware/tests.py
Dosyayı görüntüle @
f46a838e
...
...
@@ -83,6 +83,18 @@ class CommonMiddlewareTest(SimpleTestCase):
r
=
CommonMiddleware
()
.
process_response
(
request
,
response
)
self
.
assertEqual
(
r
.
url
,
'/slash/?test=1'
)
@override_settings
(
APPEND_SLASH
=
True
)
def
test_append_slash_redirect_querystring_have_slash
(
self
):
"""
APPEND_SLASH should append slash to path when redirecting a request
with a querystring ending with slash.
"""
request
=
self
.
rf
.
get
(
'/slash?test=slash/'
)
response
=
HttpResponseNotFound
()
r
=
CommonMiddleware
()
.
process_response
(
request
,
response
)
self
.
assertIsInstance
(
r
,
HttpResponsePermanentRedirect
)
self
.
assertEqual
(
r
.
url
,
'/slash/?test=slash/'
)
@override_settings
(
APPEND_SLASH
=
True
,
DEBUG
=
True
)
def
test_append_slash_no_redirect_on_POST_in_DEBUG
(
self
):
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment