summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-01-26 18:23:05 +0100
committerFlorian Bruhin <me@the-compiler.org>2021-01-26 18:23:05 +0100
commit40a118f5ab0fa9b6bcef2280cdb9783297d89213 (patch)
tree268d6b4a0c5edc8e863de71676a24d2d962f1a83
parentdb8fee275c5bed35f0747f32903d868902e951d3 (diff)
downloadqutebrowser-40a118f5ab0fa9b6bcef2280cdb9783297d89213.tar.gz
qutebrowser-40a118f5ab0fa9b6bcef2280cdb9783297d89213.zip
Enforce relative paths with resource_url
-rw-r--r--qutebrowser/utils/jinja.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/qutebrowser/utils/jinja.py b/qutebrowser/utils/jinja.py
index 59e887126..6ba11dd77 100644
--- a/qutebrowser/utils/jinja.py
+++ b/qutebrowser/utils/jinja.py
@@ -21,6 +21,7 @@
import os
import os.path
+import posixpath
import functools
import contextlib
import html
@@ -110,10 +111,9 @@ class Environment(jinja2.Environment):
Arguments:
path: The relative path to the resource.
"""
- if not os.path.isabs(path):
- path = '/' + path
+ assert not posixpath.isabs(path), path
url = QUrl('qute://resource')
- url.setPath(path)
+ url.setPath('/' + path)
urlutils.ensure_valid(url)
urlstr = url.toString(QUrl.FullyEncoded) # type: ignore[arg-type]
return urlstr