From e74d062bcdf1734328811748206a40bfab66adaf Mon Sep 17 00:00:00 2001 From: Ryan McGrath Date: Wed, 10 Jun 2015 17:09:31 +0900 Subject: [PATCH] Bugfix: directories with the same name occuring multiple times in the path could be accidentally replaced and fubar'd --- rednoise/base.py | 6 +++--- setup.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rednoise/base.py b/rednoise/base.py index 8961dd4..05c3d4e 100644 --- a/rednoise/base.py +++ b/rednoise/base.py @@ -208,13 +208,13 @@ class DjangoRedNoise(DjangoWhiteNoise): """ file_path = None if self.debug: - file_path = finders.find(path.replace(self.static_prefix, '')) + file_path = finders.find(path.replace(self.static_prefix, '', 1)) # The immediate assumption would be to just only do this in non-DEBUG # scenarios, but this here allows us to fall through to ROOT in DEBUG. if file_path is None: file_path = ('%s/%s' % ( - self.static_root, path.replace(self.static_prefix, '') + self.static_root, path.replace(self.static_prefix, '', 1) )).replace('\\', '/') if not isfile(file_path): @@ -249,7 +249,7 @@ class DjangoRedNoise(DjangoWhiteNoise): nature, so we have separate methods. """ file_path = ('%s/%s' % ( - self.media_root, path.replace(self.media_prefix, '') + self.media_root, path.replace(self.media_prefix, '', 1) )).replace('\\', '/') if isfile(file_path): files = {} diff --git a/setup.py b/setup.py index 0a18e56..a793731 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ def read(*path): setup( name='django-rednoise', - version='1.0.4', + version='1.0.5', author='Ryan McGrath', author_email='ryan@venodesigns.net', url='https://github.com/ryanmcgrath/django-rednoise/',