aboutsummaryrefslogtreecommitdiffstats
path: root/wkhtmltopdf/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'wkhtmltopdf/views.py')
-rw-r--r--wkhtmltopdf/views.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/wkhtmltopdf/views.py b/wkhtmltopdf/views.py
index 9ff5395..4d0ccca 100644
--- a/wkhtmltopdf/views.py
+++ b/wkhtmltopdf/views.py
@@ -162,11 +162,15 @@ class PDFTemplateResponse(TemplateResponse, PDFResponse):
has_scheme = re.compile(r'^[^:/]+://')
for x in overrides:
- if not has_scheme.match(x['url']):
- if not x['root'].endswith('/'):
- x['root'] += '/'
- for occur in re.findall('''["|']({0}.*?)["|']'''.format(x['url']), content):
- content = content.replace(occur, pathname2fileurl(x['root']) + occur[len(x['url']):])
+ if has_scheme.match(x['url']):
+ continue
+
+ if not x['root'].endswith('/'):
+ x['root'] += '/'
+
+ for occur in re.findall('''["|']({0}.*?)["|']'''.format(x['url']), content):
+ content = content.replace(occur, pathname2fileurl(x['root']) + occur[len(x['url']):])
+
return content