Handle spaces in DB names (#590)

Closes #503 - thanks, @rixx
This commit is contained in:
Tobias Kunze 2019-11-05 00:16:30 +01:00 committed by Simon Willison
commit e5dc89a58b
4 changed files with 26 additions and 8 deletions

View file

@ -203,12 +203,13 @@ class DataView(BaseView):
hash = hash_bit
else:
name = db_name
# Verify the hash
name = urllib.parse.unquote_plus(name)
try:
db = self.ds.databases[name]
except KeyError:
raise NotFound("Database not found: {}".format(name))
# Verify the hash
expected = "000"
if db.hash is not None:
expected = db.hash[:HASH_LENGTH]