whitenoise icon indicating copy to clipboard operation
whitenoise copied to clipboard

Fix issue with static files on Windows

Open marcperrinoptel opened this issue 2 years ago • 1 comments

See https://github.com/evansd/whitenoise/issues/472 also https://code.djangoproject.com/ticket/34341

The probable takeaway from the discussion on Django side is that finders.find() is really supposed to be called with an OS-standardized path.

I've mimicked what Django does to an url before calling finders.find():

  • step 1 (strip url base / prefix) was already done by whitenoise
  • step 2 (url2pathname) is obvious enough
  • step 3 (using posixpath.normpath, plus .lstrip('/')) seems debatable considering that we're already after url2pathname, but for the sake of mimicking Django I've included it

marcperrinoptel avatar Feb 16 '23 16:02 marcperrinoptel

This needs a test to ensure there aren't regressions.

Archmonger avatar Jul 28 '23 10:07 Archmonger