mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Fixed bug loading database called 'test-database (1).sqlite'
Closes #1181. Also now ensures that database URLs have special characters URL-quoted.
This commit is contained in:
parent
07e1635615
commit
a5ede3cdd4
7 changed files with 55 additions and 27 deletions
|
|
@ -181,6 +181,7 @@ class DataView(BaseView):
|
|||
async def resolve_db_name(self, request, db_name, **kwargs):
|
||||
hash = None
|
||||
name = None
|
||||
db_name = urllib.parse.unquote_plus(db_name)
|
||||
if db_name not in self.ds.databases and "-" in db_name:
|
||||
# No matching DB found, maybe it's a name-hash?
|
||||
name_bit, hash_bit = db_name.rsplit("-", 1)
|
||||
|
|
@ -191,7 +192,7 @@ class DataView(BaseView):
|
|||
hash = hash_bit
|
||||
else:
|
||||
name = db_name
|
||||
name = urllib.parse.unquote_plus(name)
|
||||
|
||||
try:
|
||||
db = self.ds.databases[name]
|
||||
except KeyError:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue