summaryrefslogtreecommitdiff
path: root/tests/staticfiles_tests/project
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2016-02-20 20:54:18 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2016-02-23 19:34:21 +0100
commit706b33fef80b8b0901fdd2e954e5e5ea189a528a (patch)
tree291c65ceca049cb3d648a865da2158b2f0fbc289 /tests/staticfiles_tests/project
parentc62807968d7930bfd34afc2036c67921b943592f (diff)
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.
Diffstat (limited to 'tests/staticfiles_tests/project')
-rw-r--r--tests/staticfiles_tests/project/documents/absolute_root.css1
-rw-r--r--tests/staticfiles_tests/project/documents/cached/absolute.css1
-rw-r--r--tests/staticfiles_tests/project/documents/styles_root.css1
3 files changed, 3 insertions, 0 deletions
diff --git a/tests/staticfiles_tests/project/documents/absolute_root.css b/tests/staticfiles_tests/project/documents/absolute_root.css
new file mode 100644
index 0000000000..b35ff47c9e
--- /dev/null
+++ b/tests/staticfiles_tests/project/documents/absolute_root.css
@@ -0,0 +1 @@
+@import url("/static/styles_root.css");
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);
}
diff --git a/tests/staticfiles_tests/project/documents/styles_root.css b/tests/staticfiles_tests/project/documents/styles_root.css
new file mode 100644
index 0000000000..64512630cb
--- /dev/null
+++ b/tests/staticfiles_tests/project/documents/styles_root.css
@@ -0,0 +1 @@
+/* see cached/absolute.css and absolute_root.css */