Skip to content

Commit

Permalink
Revert change to use get_script_prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahboyce committed Apr 4, 2023
1 parent 08a176a commit 207985a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/whitenoise/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from django.contrib.staticfiles import finders
from django.contrib.staticfiles.storage import staticfiles_storage
from django.http import FileResponse
from django.urls import get_script_prefix

from .base import WhiteNoise
from .string_utils import ensure_leading_trailing_slash
Expand Down Expand Up @@ -94,10 +93,10 @@ def __init__(self, get_response=None, settings=settings):
self.static_prefix = settings.WHITENOISE_STATIC_PREFIX
except AttributeError:
self.static_prefix = urlparse(settings.STATIC_URL or "").path
script_prefix = get_script_prefix().rstrip("/")
if script_prefix:
if self.static_prefix.startswith(script_prefix):
self.static_prefix = self.static_prefix[len(script_prefix) :]
if settings.FORCE_SCRIPT_NAME:
script_name = settings.FORCE_SCRIPT_NAME.rstrip("/")
if self.static_prefix.startswith(script_name):
self.static_prefix = self.static_prefix[len(script_name):]
self.static_prefix = ensure_leading_trailing_slash(self.static_prefix)

self.static_root = settings.STATIC_ROOT
Expand Down

0 comments on commit 207985a

Please sign in to comment.