[4.0.x] Fixed #33237 -- Fixed detecting source maps in ManifestStaticFilesStorage for multiline files.
Switched regex to multiline mode in order to match per-line, rather than against the whole file. Thanks to Joseph Abrahams for the report. Regression in781b44240a
. Backport of4816dc9428
from main
This commit is contained in:
parent
6fc689a22d
commit
499384b6d1
|
@ -54,7 +54,7 @@ class HashedFilesMixin:
|
||||||
)),
|
)),
|
||||||
('*.js', (
|
('*.js', (
|
||||||
(
|
(
|
||||||
r'(?P<matched>)^(//# (?-i:sourceMappingURL)=(?P<url>.*))$',
|
r'(?m)(?P<matched>)^(//# (?-i:sourceMappingURL)=(?P<url>.*))$',
|
||||||
'//# sourceMappingURL=%(url)s',
|
'//# sourceMappingURL=%(url)s',
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
//# sourceMappingURL=source_map.js.map
|
//# sourceMappingURL=source_map.js.map
|
||||||
|
let a_variable = 1;
|
||||||
|
|
|
@ -260,7 +260,7 @@ class TestHashedFiles:
|
||||||
|
|
||||||
def test_js_source_map(self):
|
def test_js_source_map(self):
|
||||||
relpath = self.hashed_file_path('cached/source_map.js')
|
relpath = self.hashed_file_path('cached/source_map.js')
|
||||||
self.assertEqual(relpath, 'cached/source_map.9371cbb02a26.js')
|
self.assertEqual(relpath, 'cached/source_map.cd45b8534a87.js')
|
||||||
with storage.staticfiles_storage.open(relpath) as relfile:
|
with storage.staticfiles_storage.open(relpath) as relfile:
|
||||||
content = relfile.read()
|
content = relfile.read()
|
||||||
self.assertNotIn(b'//# sourceMappingURL=source_map.js.map', content)
|
self.assertNotIn(b'//# sourceMappingURL=source_map.js.map', content)
|
||||||
|
|
Loading…
Reference in New Issue