diff --git a/qutebrowser/misc/mhtml.py b/qutebrowser/misc/mhtml.py
index 25972d127..4c77a9829 100644
--- a/qutebrowser/misc/mhtml.py
+++ b/qutebrowser/misc/mhtml.py
@@ -42,11 +42,11 @@ _File = collections.namedtuple("_File",
_CSS_URL_PATTERNS = [re.compile(x) for x in [
- rb"@import '(?P[^']+)'",
- rb'@import "(?P[^"]+)"',
- rb'''url\((?P[^'"][^)]*)\)''',
- rb'url\("(?P[^"]+)"\)',
- rb"url\('(?P[^']+)'\)",
+ r"@import '(?P[^']+)'",
+ r'@import "(?P[^"]+)"',
+ r'''url\((?P[^'"][^)]*)\)''',
+ r'url\("(?P[^"]+)"\)',
+ r"url\('(?P[^']+)'\)",
]]
@@ -56,10 +56,8 @@ def _get_css_imports(data):
The returned URLs are relative to the stylesheet's URL.
Args:
- data: The content of the stylesheet to scan.
+ data: The content of the stylesheet to scan as string.
"""
- if isinstance(data, str):
- data = data.encode("utf-8")
urls = []
for pattern in _CSS_URL_PATTERNS:
for match in pattern.finditer(data):
@@ -246,11 +244,11 @@ class _Downloader():
self.writer = MHTMLWriter(
web_frame.toHtml().encode("utf-8"),
- content_location = web_url.toString(),
+ content_location=web_url.toString(),
# I've found no way of getting the content type of a QWebView, but
# since we're using .toHtml, it's probably safe to say that the
# content-type is HTML
- content_type = 'text/html; charset="UTF-8"',
+ content_type='text/html; charset="UTF-8"',
)
# Currently only downloading (stylesheets),