diff options
author | Florian Bruhin <me@the-compiler.org> | 2021-01-26 18:23:05 +0100 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2021-01-26 18:23:05 +0100 |
commit | 40a118f5ab0fa9b6bcef2280cdb9783297d89213 (patch) | |
tree | 268d6b4a0c5edc8e863de71676a24d2d962f1a83 /qutebrowser | |
parent | db8fee275c5bed35f0747f32903d868902e951d3 (diff) | |
download | qutebrowser-40a118f5ab0fa9b6bcef2280cdb9783297d89213.tar.gz qutebrowser-40a118f5ab0fa9b6bcef2280cdb9783297d89213.zip |
Enforce relative paths with resource_url
Diffstat (limited to 'qutebrowser')
-rw-r--r-- | qutebrowser/utils/jinja.py | 6 |
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 |