Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed #21162 -- Better emulation of staticfiles middleware.

Code had been added in e909cea. Solves test suite failures observed
on Windows.

Thanks Michael Manfre for the report. Refs #20739.
  • Loading branch information...
commit 783620ccc827057d1d0f2c6f4808350be9193bf9 1 parent 47e79bf
@ramiro ramiro authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 django/test/
6 django/test/
@@ -958,7 +958,11 @@ def get_response(self, request):
def serve(self, request):
os_rel_path = self.file_path(request.path)
- final_rel_path = posixpath.normpath(unquote(os_rel_path)).lstrip('/')
+ os_rel_path = posixpath.normpath(unquote(os_rel_path))
+ # Emulate behavior of django.contrib.staticfiles.views.serve() when it
+ # invokes staticfiles' finders functionality.
+ # TODO: Modify if/when that internal API is refactored
+ final_rel_path = os_rel_path.replace('\\', '/').lstrip('/')
return serve(request, final_rel_path, document_root=self.get_base_dir())
def __call__(self, environ, start_response):

0 comments on commit 783620c

Please sign in to comment.
Something went wrong with that request. Please try again.