home / github

Menu
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

5 rows where issue = 1160750713

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

id ▼ html_url issue_url node_id user created_at updated_at author_association body reactions issue performed_via_github_app
1060836262 https://github.com/simonw/datasette/issues/1650#issuecomment-1060836262 https://api.github.com/repos/simonw/datasette/issues/1650 IC_kwDOBm6k_c4_OxOm simonw 9599 2022-03-07T15:52:09Z 2022-03-07T15:52:09Z OWNER This is a bit tricky. I tried this, sending a redirect only if a 404 happens: ```diff diff --git a/datasette/app.py b/datasette/app.py index 8c5480c..420664c 100644 --- a/datasette/app.py +++ b/datasette/app.py @@ -1211,6 +1211,10 @@ class DatasetteRouter: return await self.handle_404(request, send) async def handle_404(self, request, send, exception=None): + # If path contains % encoding, redirect to dash encoding + if '%' in request.scope["path"]: + await asgi_send_redirect(send, request.scope["path"].replace("%", "-")) + return # If URL has a trailing slash, redirect to URL without it path = request.scope.get( "raw_path", request.scope["path"].encode("utf8") ``` But this URL didn't work: - http://127.0.0.1:8001/fivethirtyeight/twitter-ratio%2Fsenators I was expecting that to redirect to this page: - http://127.0.0.1:8001/fivethirtyeight/twitter-2Dratio-2Fsenators But instead it took me to another 404: - http://127.0.0.1:8001/fivethirtyeight/twitter-ratio%2Fsenators This is because that URL contains both a %-escaped `/` AND a plain `-` - which was not escaped in the old system but is escaped in the new system. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} Implement redirects from old % encoding to new dash encoding 1160750713  
1060863311 https://github.com/simonw/datasette/issues/1650#issuecomment-1060863311 https://api.github.com/repos/simonw/datasette/issues/1650 IC_kwDOBm6k_c4_O31P simonw 9599 2022-03-07T16:13:17Z 2022-03-07T16:13:17Z OWNER This doesn't seem to work. https://latest.datasette.io/fixtures/table%2Fwith%2Fslashes.csv should be redirecting now that this is deployed - which it is, because https://latest.datasette.io/-/versions shows 644d25d1de78a36b105cca479e7b3e4375a6eadc - but I'm not getting that redirect. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} Implement redirects from old % encoding to new dash encoding 1160750713  
1060864823 https://github.com/simonw/datasette/issues/1650#issuecomment-1060864823 https://api.github.com/repos/simonw/datasette/issues/1650 IC_kwDOBm6k_c4_O4M3 simonw 9599 2022-03-07T16:14:33Z 2022-03-07T16:14:33Z OWNER Same problem here: https://fivethirtyeight.datasettes.com/fivethirtyeight/ahca-2Dpolls%2Fahca_polls should redirect but doesn't. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} Implement redirects from old % encoding to new dash encoding 1160750713  
1061038414 https://github.com/simonw/datasette/issues/1650#issuecomment-1061038414 https://api.github.com/repos/simonw/datasette/issues/1650 IC_kwDOBm6k_c4_PilO simonw 9599 2022-03-07T19:14:04Z 2022-03-07T19:14:04Z OWNER The problem seems to be that `http://127.0.0.1:8002/fixtures/table%2Fwith%2Fslashes.csv` doesn't result in a 404 at all. If it did, it would be redirected. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} Implement redirects from old % encoding to new dash encoding 1160750713  
1061041034 https://github.com/simonw/datasette/issues/1650#issuecomment-1061041034 https://api.github.com/repos/simonw/datasette/issues/1650 IC_kwDOBm6k_c4_PjOK simonw 9599 2022-03-07T19:16:51Z 2022-03-07T19:16:51Z OWNER Here's the problem: https://github.com/simonw/datasette/blob/020effe47bf89f35182960a9645f2383a42ebd54/datasette/utils/__init__.py#L1173-L1175 Which is called here: https://github.com/simonw/datasette/blob/1baa030eca375f839f3471237547ab403523e643/datasette/views/base.py#L469-L473 So `table%2Fwith%2Fslashes` ends up decoded as if it was using dash encoding. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} Implement redirects from old % encoding to new dash encoding 1160750713  

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
, [performed_via_github_app] TEXT);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Queries took 19.58ms · About: simonw/datasette-graphql