mirror of
https://github.com/django/django.git
synced 2025-01-03 06:55:47 +00:00
Fixed #1291 -- Fixed a potential infinite loop for some URL constructions in
the development server. Thanks, Graham Carlyle. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6731 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
3c272792d6
commit
b6002d4af6
1
AUTHORS
1
AUTHORS
@ -71,6 +71,7 @@ answer newbie questions, and generally made Django that much better:
|
|||||||
Jonathan Buchanan <jonathan.buchanan@gmail.com>
|
Jonathan Buchanan <jonathan.buchanan@gmail.com>
|
||||||
Trevor Caira <trevor@caira.com>
|
Trevor Caira <trevor@caira.com>
|
||||||
Ricardo Javier Cárdenes Medina <ricardo.cardenes@gmail.com>
|
Ricardo Javier Cárdenes Medina <ricardo.cardenes@gmail.com>
|
||||||
|
Graham Carlyle <graham.carlyle@maplecroft.net>
|
||||||
Antonio Cavedoni <http://cavedoni.com/>
|
Antonio Cavedoni <http://cavedoni.com/>
|
||||||
C8E
|
C8E
|
||||||
cedric@terramater.net
|
cedric@terramater.net
|
||||||
|
@ -33,6 +33,7 @@ def serve(request, path, document_root=None, show_indexes=False):
|
|||||||
|
|
||||||
# Clean up given path to only allow serving files below document_root.
|
# Clean up given path to only allow serving files below document_root.
|
||||||
path = posixpath.normpath(urllib.unquote(path))
|
path = posixpath.normpath(urllib.unquote(path))
|
||||||
|
path = path.lstrip('/')
|
||||||
newpath = ''
|
newpath = ''
|
||||||
for part in path.split('/'):
|
for part in path.split('/'):
|
||||||
if not part:
|
if not part:
|
||||||
|
@ -12,4 +12,12 @@ class StaticTests(TestCase):
|
|||||||
for filename in media_files:
|
for filename in media_files:
|
||||||
response = self.client.get('/views/site_media/%s' % filename)
|
response = self.client.get('/views/site_media/%s' % filename)
|
||||||
file = open(path.join(media_dir, filename))
|
file = open(path.join(media_dir, filename))
|
||||||
self.assertEquals(file.read(), response.content)
|
self.assertEquals(file.read(), response.content)
|
||||||
|
|
||||||
|
def test_copes_with_empty_path_component(self):
|
||||||
|
file_name = 'file.txt'
|
||||||
|
response = self.client.get('/views/site_media//%s' % file_name)
|
||||||
|
file = open(path.join(media_dir, file_name))
|
||||||
|
self.assertEquals(file.read(), response.content)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user