Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-pipeline
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-pipeline
Commits
e727288d
Commit
e727288d
authored
Feb 03, 2015
by
Josh Braegger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include quotes in NON_REWRITABLE_URLS
parent
4751a12a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
pipeline/compressors/__init__.py
+4
-3
tests/assets/css/nested/nested.css
+3
-0
tests/tests/test_compressor.py
+3
-0
No files found.
pipeline/compressors/__init__.py
View file @
e727288d
...
...
@@ -14,7 +14,7 @@ from pipeline.conf import settings
from
pipeline.utils
import
to_class
,
relpath
from
pipeline.exceptions
import
CompressorError
URL_DETECTOR
=
r"""url\(
['"]
{0,1}\s*(.*?)["']{0,1}\)"""
URL_DETECTOR
=
r"""url\(
(['"])
{0,1}\s*(.*?)["']{0,1}\)"""
URL_REPLACER
=
r"""url\(__EMBED__(.+?)(\?\d+)?\)"""
NON_REWRITABLE_URL
=
re
.
compile
(
r'^(http:|https:|data:|//)'
)
...
...
@@ -127,9 +127,10 @@ class Compressor(object):
stylesheets
=
[]
for
path
in
paths
:
def
reconstruct
(
match
):
asset_path
=
match
.
group
(
1
)
quote
=
match
.
group
(
1
)
or
''
asset_path
=
match
.
group
(
2
)
if
NON_REWRITABLE_URL
.
match
(
asset_path
):
return
"url(
%
s
)"
%
asset_path
return
"url(
%
s
%
s
%
s)"
%
(
quote
,
asset_path
,
quote
)
asset_url
=
self
.
construct_asset_path
(
asset_path
,
path
,
output_filename
,
variant
)
return
"url(
%
s)"
%
asset_url
...
...
tests/assets/css/nested/nested.css
View file @
e727288d
.data-url
{
background-image
:
url(data:image/svg+xml;charset=US-ASCII,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22iso-8859-1%22%3F%3E%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20%20width%3D%2212px%22%20height%3D%2214px%22%20viewBox%3D%220%200%2012%2014%22%20style%3D%22enable-background%3Anew%200%200%2012%2014%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20d%3D%22M11%2C6V5c0-2.762-2.239-5-5-5S1%2C2.238%2C1%2C5v1H0v8h12V6H11z%20M6.5%2C9.847V12h-1V9.847C5.207%2C9.673%2C5%2C9.366%2C5%2C9%20c0-0.553%2C0.448-1%2C1-1s1%2C0.447%2C1%2C1C7%2C9.366%2C6.793%2C9.673%2C6.5%2C9.847z%20M9%2C6H3V5c0-1.657%2C1.343-3%2C3-3s3%2C1.343%2C3%2C3V6z%22%2F%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3C%2Fsvg%3E)
;
}
.data-url-quoted
{
background-image
:
url('data:image/svg+xml;charset=US-ASCII,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22iso-8859-1%22%3F%3E%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20%20width%3D%2212px%22%20height%3D%2214px%22%20viewBox%3D%220%200%2012%2014%22%20style%3D%22enable-background%3Anew%200%200%2012%2014%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20d%3D%22M11%2C6V5c0-2.762-2.239-5-5-5S1%2C2.238%2C1%2C5v1H0v8h12V6H11z%20M6.5%2C9.847V12h-1V9.847C5.207%2C9.673%2C5%2C9.366%2C5%2C9%20c0-0.553%2C0.448-1%2C1-1s1%2C0.447%2C1%2C1C7%2C9.366%2C6.793%2C9.673%2C6.5%2C9.847z%20M9%2C6H3V5c0-1.657%2C1.343-3%2C3-3s3%2C1.343%2C3%2C3V6z%22%2F%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3C%2Fsvg%3E')
;
}
tests/tests/test_compressor.py
View file @
e727288d
...
...
@@ -163,6 +163,9 @@ class CompressorTest(TestCase):
self
.
assertEqual
(
""".data-url {
background-image: url(data:image/svg+xml;charset=US-ASCII,
%3
C
%3
Fxml
%20
version
%3
D
%221.0%22%20
encoding
%3
D
%22
iso-8859-1
%22%3
F
%3
E
%3
C!DOCTYPE
%20
svg
%20
PUBLIC
%20%22
-
%2
F
%2
FW3C
%2
F
%2
FDTD
%20
SVG
%201.1%2
F
%2
FEN
%22%20%22
http
%3
A
%2
F
%2
Fwww.w3.org
%2
FGraphics
%2
FSVG
%2
F1.1
%2
FDTD
%2
Fsvg11.dtd
%22%3
E
%3
Csvg
%20
version
%3
D
%221.1%22%20
id
%3
D
%22
Layer_1
%22%20
xmlns
%3
D
%22
http
%3
A
%2
F
%2
Fwww.w3.org
%2
F2000
%2
Fsvg
%22%20
xmlns
%3
Axlink
%3
D
%22
http
%3
A
%2
F
%2
Fwww.w3.org
%2
F1999
%2
Fxlink
%22%20
x
%3
D
%220
px
%22%20
y
%3
D
%220
px
%22%20%20
width
%3
D
%2212
px
%22%20
height
%3
D
%2214
px
%22%20
viewBox
%3
D
%220%200%2012%2014%22%20
style
%3
D
%22
enable-background
%3
Anew
%200%200%2012%2014%3
B
%22%20
xml
%3
Aspace
%3
D
%22
preserve
%22%3
E
%3
Cpath
%20
d
%3
D
%22
M11
%2
C6V5c0-2.762-2.239-5-5-5S1
%2
C2.238
%2
C1
%2
C5v1H0v8h12V6H11z
%20
M6.5
%2
C9.847V12h-1V9.847C5.207
%2
C9.673
%2
C5
%2
C9.366
%2
C5
%2
C9
%20
c0-0.553
%2
C0.448-1
%2
C1-1s1
%2
C0.447
%2
C1
%2
C1C7
%2
C9.366
%2
C6.793
%2
C9.673
%2
C6.5
%2
C9.847z
%20
M9
%2
C6H3V5c0-1.657
%2
C1.343-3
%2
C3-3s3
%2
C1.343
%2
C3
%2
C3V6z
%22%2
F
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
C
%2
Fsvg
%3
E);
}
.data-url-quoted {
background-image: url('data:image/svg+xml;charset=US-ASCII,
%3
C
%3
Fxml
%20
version
%3
D
%221.0%22%20
encoding
%3
D
%22
iso-8859-1
%22%3
F
%3
E
%3
C!DOCTYPE
%20
svg
%20
PUBLIC
%20%22
-
%2
F
%2
FW3C
%2
F
%2
FDTD
%20
SVG
%201.1%2
F
%2
FEN
%22%20%22
http
%3
A
%2
F
%2
Fwww.w3.org
%2
FGraphics
%2
FSVG
%2
F1.1
%2
FDTD
%2
Fsvg11.dtd
%22%3
E
%3
Csvg
%20
version
%3
D
%221.1%22%20
id
%3
D
%22
Layer_1
%22%20
xmlns
%3
D
%22
http
%3
A
%2
F
%2
Fwww.w3.org
%2
F2000
%2
Fsvg
%22%20
xmlns
%3
Axlink
%3
D
%22
http
%3
A
%2
F
%2
Fwww.w3.org
%2
F1999
%2
Fxlink
%22%20
x
%3
D
%220
px
%22%20
y
%3
D
%220
px
%22%20%20
width
%3
D
%2212
px
%22%20
height
%3
D
%2214
px
%22%20
viewBox
%3
D
%220%200%2012%2014%22%20
style
%3
D
%22
enable-background
%3
Anew
%200%200%2012%2014%3
B
%22%20
xml
%3
Aspace
%3
D
%22
preserve
%22%3
E
%3
Cpath
%20
d
%3
D
%22
M11
%2
C6V5c0-2.762-2.239-5-5-5S1
%2
C2.238
%2
C1
%2
C5v1H0v8h12V6H11z
%20
M6.5
%2
C9.847V12h-1V9.847C5.207
%2
C9.673
%2
C5
%2
C9.366
%2
C5
%2
C9
%20
c0-0.553
%2
C0.448-1
%2
C1-1s1
%2
C0.447
%2
C1
%2
C1C7
%2
C9.366
%2
C6.793
%2
C9.673
%2
C6.5
%2
C9.847z
%20
M9
%2
C6H3V5c0-1.657
%2
C1.343-3
%2
C3-3s3
%2
C1.343
%2
C3
%2
C3V6z
%22%2
F
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
Cg
%3
E
%3
C
%2
Fg
%3
E
%3
C
%2
Fsvg
%3
E');
}
"""
,
output
)
def
test_compressor_subprocess_unicode
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment