misc: add missing errors import before raising themes 404 errors (#37373)

This commit is contained in:
Frédéric Péters 2019-10-31 07:46:02 +01:00
parent d57ade1eac
commit f30ca1a8e1
2 changed files with 6 additions and 0 deletions

View File

@ -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)

View File

@ -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()