home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

7 rows where issue = 972918533 sorted by updated_at descending

✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 1

  • simonw 7

issue 1

  • Query page .csv and .json links are not correctly URL-encoded on Vercel under unknown specific conditions · 7 ✖

author_association 1

  • OWNER 7
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
900690998 https://github.com/simonw/datasette/issues/1438#issuecomment-900690998 https://api.github.com/repos/simonw/datasette/issues/1438 IC_kwDOBm6k_c41r3Q2 simonw 9599 2021-08-17T23:11:16Z 2021-08-17T23:12:25Z OWNER

I have completely failed to replicate this initial bug - but it's still there on the thesession.vercel.app deployment (even though my own deployments to Vercel do not exhibit it). Here's a one-liner to replicate it against that deployment:

curl -s 'https://thesession.vercel.app/thesession?sql=select+*+from+tunes+where+name+like+%22%25wise+maid%25%22' | rg '.csv'

Whit outputs this:

<p class="export-links">This data as <a href="/thesession.json?sql=select * from tunes where name like "%wise maid%"">json</a>, <a href="/thesession.csv?sql=select * from tunes where name like "%wise maid%"&_size=max">CSV</a></p>

It looks like, rather than being URL-encoded, the original query string is somehow making it through to Jinja and then being auto-escaped there.

The weird thing is that the equivalent query executed against my til.simonwillison.net Vercel instance does this:

curl -s 'https://til.simonwillison.net/fixtures?sql=select+*+from+searchable+where+text1+like+%22%25a%25%22' | rg '.csv'

<p class="export-links">This data as <a href="/fixtures.json?sql=select%20*%20from%20searchable%20where%20text1%20like%20%22%25a%25%22">json</a>, <a href="/fixtures.csv?sql=select%20*%20from%20searchable%20where%20text1%20like%20%22%25a%25%22&_size=max">CSV</a></p>

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Query page .csv and .json links are not correctly URL-encoded on Vercel under unknown specific conditions 972918533  
900681413 https://github.com/simonw/datasette/issues/1438#issuecomment-900681413 https://api.github.com/repos/simonw/datasette/issues/1438 IC_kwDOBm6k_c41r07F simonw 9599 2021-08-17T22:47:44Z 2021-08-17T22:47:44Z OWNER

I deployed another copy of fixtures.db on Vercel at https://til.simonwillison.net/fixtures so I can compare it with fixtures.db on Cloud Run at https://latest.datasette.io/fixtures

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Query page .csv and .json links are not correctly URL-encoded on Vercel under unknown specific conditions 972918533  
900518343 https://github.com/simonw/datasette/issues/1438#issuecomment-900518343 https://api.github.com/repos/simonw/datasette/issues/1438 IC_kwDOBm6k_c41rNHH simonw 9599 2021-08-17T18:04:42Z 2021-08-17T18:04:42Z OWNER

Here's how request.query_string works: https://github.com/simonw/datasette/blob/adb5b70de5cec3c3dd37184defe606a082c232cf/datasette/utils/asgi.py#L86-L88

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Query page .csv and .json links are not correctly URL-encoded on Vercel under unknown specific conditions 972918533  
900516826 https://github.com/simonw/datasette/issues/1438#issuecomment-900516826 https://api.github.com/repos/simonw/datasette/issues/1438 IC_kwDOBm6k_c41rMva simonw 9599 2021-08-17T18:02:27Z 2021-08-17T18:02:27Z OWNER

The key difference I can spot between Vercel and Cloud Run is that + in a query string gets converted to %20 by Vercel before it gets to my app, but does not for Cloud Run: ```

Vercel

~ % curl -s 'https://til.simonwillison.net/-/asgi-scope?sql=select++from+tunes+where+name+like+%22%25wise+maid%25%22%0D%0A' | rg 'query_string' -C 2 'method': 'GET', 'path': '/-/asgi-scope', 'query_string': b'sql=select%20%20from%20tunes%20where%20name%20like%20%22%25' b'wise%20maid%25%22%0D%0A', 'raw_path': b'/-/asgi-scope',

Cloud Run

~ % curl -s 'https://latest-with-plugins.datasette.io/-/asgi-scope?sql=select++from+tunes+where+name+like+%22%25wise+maid%25%22%0D%0A' | rg 'query_string' -C 2 'method': 'GET', 'path': '/-/asgi-scope', 'query_string': b'sql=select++from+tunes+where+name+like+%22%25wise+maid%25%2' b'2%0D%0A', 'raw_path': b'/-/asgi-scope', ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Query page .csv and .json links are not correctly URL-encoded on Vercel under unknown specific conditions 972918533  
900513267 https://github.com/simonw/datasette/issues/1438#issuecomment-900513267 https://api.github.com/repos/simonw/datasette/issues/1438 IC_kwDOBm6k_c41rL3z simonw 9599 2021-08-17T17:57:05Z 2021-08-17T17:57:05Z OWNER

I'm having trouble replicating this bug outside of Vercel. Against Cloud Run: view-source:https://latest.datasette.io/fixtures?sql=select+*+from+searchable+where+text1+like+%22%25cat%25%22

The HTML here is:

```html

This data as json, ... CSV

```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Query page .csv and .json links are not correctly URL-encoded on Vercel under unknown specific conditions 972918533  
900502364 https://github.com/simonw/datasette/issues/1438#issuecomment-900502364 https://api.github.com/repos/simonw/datasette/issues/1438 IC_kwDOBm6k_c41rJNc simonw 9599 2021-08-17T17:40:41Z 2021-08-17T17:40:41Z OWNER

Bug is likely in path_with_format itself: https://github.com/simonw/datasette/blob/adb5b70de5cec3c3dd37184defe606a082c232cf/datasette/utils/init.py#L710-L729

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Query page .csv and .json links are not correctly URL-encoded on Vercel under unknown specific conditions 972918533  
900500824 https://github.com/simonw/datasette/issues/1438#issuecomment-900500824 https://api.github.com/repos/simonw/datasette/issues/1438 IC_kwDOBm6k_c41rI1Y simonw 9599 2021-08-17T17:38:16Z 2021-08-17T17:38:16Z OWNER

Relevant template code: https://github.com/simonw/datasette/blob/adb5b70de5cec3c3dd37184defe606a082c232cf/datasette/templates/query.html#L71

renderers comes from here: https://github.com/simonw/datasette/blob/2883098770fc66e50183b2b231edbde20848d4d6/datasette/views/base.py#L593-L608

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Query page .csv and .json links are not correctly URL-encoded on Vercel under unknown specific conditions 972918533  

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 27.875ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows