issue_comments: 1060067031
This data as json
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/simonw/datasette/pull/1648#issuecomment-1060067031 | https://api.github.com/repos/simonw/datasette/issues/1648 | 1060067031 | IC_kwDOBm6k_c4_L1bX | 9599 | 2022-03-06T23:50:40Z | 2022-03-06T23:58:31Z | OWNER | I may have to do extra work here ```python def database(self, database, format=None): db = self.ds.databases[database] if self.ds.setting("hash_urls") and db.hash: path = self.path( f"{dash_encode(database)}-{db.hash[:HASH_LENGTH]}", format=format ) else: path = self.path(dash_encode(database), format=format) return path ``` The URLs that incorporate a hash have a `dbname-hash` format - will that `-` in the middle there mess up the dash decoding mechanism? I think it will. Might be able to solve that like so: ```python async def resolve_db_name(self, request, db_name, **kwargs): hash = None name = None decoded_name = dash_decode(db_name) if decoded_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) if dash_decode(name_bit) not in self.ds.databases: raise NotFound(f"Database not found: {name}") else: name = dash_decode(name_bit) hash = hash_bit else: name = decoded_name ``` | {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} | 1160432941 |