Ticket #1291: static_serve_empty_path_compnent.diff
File static_serve_empty_path_compnent.diff, 1.3 KB (added by , 17 years ago) |
---|
-
django/views/static.py
33 33 34 34 # Clean up given path to only allow serving files below document_root. 35 35 path = posixpath.normpath(urllib.unquote(path)) 36 path = path.lstrip('/') 36 37 newpath = '' 37 38 for part in path.split('/'): 38 39 if not part: -
tests/regressiontests/views/tests/static.py
12 12 for filename in media_files: 13 13 response = self.client.get('/views/site_media/%s' % filename) 14 14 file = open(path.join(media_dir, filename)) 15 self.assertEquals(file.read(), response.content) 16 No newline at end of file 15 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