mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
fix css url parsing typo
always default to utf-8 if chardet thinks ascii tweak banner
This commit is contained in:
parent
1e03cad25c
commit
c3767cd31b
@ -191,9 +191,12 @@ class CSSRewriter(RegexRewriter):
|
||||
>>> test_css("@import (\"url.css\")")
|
||||
'@import ("/web/20131010im_/http://example.com/url.css")'
|
||||
|
||||
>>> test_css("@import url(/url.css)\n@import url(/anotherurl.css)\n @import url(/and_a_third.css)")
|
||||
'@import url(/web/20131010im_/http://example.com/url.css)\n@import url(/web/20131010im_/http://example.com/anotherurl.css)\n @import url(/web/20131010im_/http://example.com/and_a_third.css)'
|
||||
|
||||
"""
|
||||
|
||||
CSS_URL_REGEX = "url\\s*\\(\\s*[\\\\\"']*([^'\"]+)[\\\\\"']*\\s*\\)"
|
||||
CSS_URL_REGEX = "url\\s*\\(\\s*[\\\\\"']*([^)'\"]+)[\\\\\"']*\\s*\\)"
|
||||
CSS_IMPORT_NO_URL_REGEX = "@import\\s+(?!url)\\(?\\s*['\"]?(?!url[\\s\\(])([\w.:/\\\\-]+)"
|
||||
|
||||
def __init__(self, rewriter):
|
||||
|
@ -196,10 +196,10 @@ class RewritingReplayHandler(ReplayHandler):
|
||||
else:
|
||||
(encoding, firstBuff) = self._detectCharset(stream)
|
||||
|
||||
# if ascii, set to noop encode operation
|
||||
# if chardet thinks its ascii, use utf-8
|
||||
if encoding == 'ascii':
|
||||
encoding = None
|
||||
#encoding = 'utf-8'
|
||||
#encoding = None
|
||||
encoding = 'utf-8'
|
||||
|
||||
# Buffering response for html, streaming for others?
|
||||
if rewrittenHeaders.textType == 'html':
|
||||
|
@ -4,7 +4,7 @@
|
||||
display: block !important;
|
||||
top: 0px !important;
|
||||
left: 0px !important;
|
||||
position: relative !important;
|
||||
position: absolute !important;
|
||||
padding: 4px !important;
|
||||
width: 100% !important;
|
||||
font-size: 24px !important;
|
||||
|
Loading…
x
Reference in New Issue
Block a user