Django

Code

Changeset 6731

Show
Ignore:
Timestamp:
11/29/07 09:47:47 (1 year ago)
Author:
mtredinnick
Message:

Fixed #1291 -- Fixed a potential infinite loop for some URL constructions in
the development server. Thanks, Graham Carlyle.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/AUTHORS

    r6664 r6731  
    7272    Trevor Caira <trevor@caira.com> 
    7373    Ricardo Javier Cárdenes Medina <ricardo.cardenes@gmail.com> 
     74    Graham Carlyle <graham.carlyle@maplecroft.net> 
    7475    Antonio Cavedoni <http://cavedoni.com/> 
    7576    C8E 
  • django/trunk/django/views/static.py

    r6634 r6731  
    3434    # Clean up given path to only allow serving files below document_root. 
    3535    path = posixpath.normpath(urllib.unquote(path)) 
     36    path = path.lstrip('/') 
    3637    newpath = '' 
    3738    for part in path.split('/'): 
  • django/trunk/tests/regressiontests/views/tests/static.py

    r6370 r6731  
    1414            file = open(path.join(media_dir, filename)) 
    1515            self.assertEquals(file.read(), response.content) 
     16 
     17    def test_copes_with_empty_path_component(self): 
     18        file_name = 'file.txt' 
     19        response = self.client.get('/views/site_media//%s' % file_name) 
     20        file = open(path.join(media_dir, file_name)) 
     21        self.assertEquals(file.read(), response.content) 
     22         
     23