From 706b33fef80b8b0901fdd2e954e5e5ea189a528a Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Sat, 20 Feb 2016 20:54:18 +0100 Subject: Fixed #26249 -- Fixed collectstatic crash for files in STATIC_ROOT referenced by absolute URL. collectstatic crashed when: * a hashing static file storage backend was used * a static file referenced another static file located directly in STATIC_ROOT (not a subdirectory) with an absolute URL (which must start with STATIC_URL, which cannot be empty) It seems to me that the current code reimplements relative path joining and doesn't handle edge cases correctly. I suspect it assumes that STATIC_URL is of the form r'/[^/]+/'. Throwing out that code in favor of the posixpath module makes the logic easier to follow. Handling absolute paths correctly also becomes easier. --- tests/staticfiles_tests/project/documents/cached/absolute.css | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/staticfiles_tests/project/documents/cached') diff --git a/tests/staticfiles_tests/project/documents/cached/absolute.css b/tests/staticfiles_tests/project/documents/cached/absolute.css index 03f2ae791a..6a2040b413 100644 --- a/tests/staticfiles_tests/project/documents/cached/absolute.css +++ b/tests/staticfiles_tests/project/documents/cached/absolute.css @@ -1,4 +1,5 @@ @import url("/static/cached/styles.css"); +@import url("/static/styles_root.css"); body { background: #d3d6d8 url(/static/cached/img/relative.png); } -- cgit v1.3