misc: add missing errors import before raising themes 404 errors (#37373)
This commit is contained in:
parent
d57ade1eac
commit
f30ca1a8e1
|
@ -5253,6 +5253,11 @@ def test_settings_theme_download_upload(pub):
|
|||
assert os.path.exists(os.path.join(pub.app_dir, 'themes/alto/foobar.txt'))
|
||||
|
||||
assert app.get('/themes/alto/foobar.txt').body == 'XXX'
|
||||
assert 'Directory listing denied' in app.get('/themes/alto/', status=200).body
|
||||
|
||||
assert app.get('/themes/alto/plop', status=404)
|
||||
assert app.get('/themes/alto/../', status=404)
|
||||
assert app.get('/themes/xxx/../', status=404)
|
||||
|
||||
def test_bounces(pub):
|
||||
create_superuser(pub)
|
||||
|
|
|
@ -65,6 +65,7 @@ def get_theme_directory(theme_id):
|
|||
|
||||
class ThemesDirectory(Directory):
|
||||
def _q_lookup(self, name):
|
||||
from . import errors
|
||||
if name in ('.', '..'):
|
||||
raise errors.TraversalError()
|
||||
|
||||
|
|
Loading…
Reference in New Issue