1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-24 06:59:52 +01:00

fix css url parsing typo

always default to utf-8 if chardet thinks ascii
tweak banner
This commit is contained in:
Ilya Kreymer 2014-01-03 21:38:18 +00:00
parent 1e03cad25c
commit c3767cd31b
3 changed files with 8 additions and 5 deletions

View File

@ -191,9 +191,12 @@ class CSSRewriter(RegexRewriter):
>>> test_css("@import (\"url.css\")") >>> test_css("@import (\"url.css\")")
'@import ("/web/20131010im_/http://example.com/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.:/\\\\-]+)" CSS_IMPORT_NO_URL_REGEX = "@import\\s+(?!url)\\(?\\s*['\"]?(?!url[\\s\\(])([\w.:/\\\\-]+)"
def __init__(self, rewriter): def __init__(self, rewriter):

View File

@ -196,10 +196,10 @@ class RewritingReplayHandler(ReplayHandler):
else: else:
(encoding, firstBuff) = self._detectCharset(stream) (encoding, firstBuff) = self._detectCharset(stream)
# if ascii, set to noop encode operation # if chardet thinks its ascii, use utf-8
if encoding == 'ascii': if encoding == 'ascii':
encoding = None #encoding = None
#encoding = 'utf-8' encoding = 'utf-8'
# Buffering response for html, streaming for others? # Buffering response for html, streaming for others?
if rewrittenHeaders.textType == 'html': if rewrittenHeaders.textType == 'html':

View File

@ -4,7 +4,7 @@
display: block !important; display: block !important;
top: 0px !important; top: 0px !important;
left: 0px !important; left: 0px !important;
position: relative !important; position: absolute !important;
padding: 4px !important; padding: 4px !important;
width: 100% !important; width: 100% !important;
font-size: 24px !important; font-size: 24px !important;