home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

9 rows where author_association = "OWNER", issue = 756439516 and user = 9599 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 · 9 ✖

issue 1

  • Datasette on Amazon Linux on ARM returns 404 for static assets · 9 ✖

author_association 1

  • OWNER · 9 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
738215686 https://github.com/simonw/datasette/issues/1124#issuecomment-738215686 https://api.github.com/repos/simonw/datasette/issues/1124 MDEyOklzc3VlQ29tbWVudDczODIxNTY4Ng== simonw 9599 2020-12-03T18:50:48Z 2020-12-03T21:42:02Z OWNER

I'm going to punt on writing a unit test for this (not sure how I'd simulate those symlinks) - I'll manually test it and push out a dot release instead.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Datasette on Amazon Linux on ARM returns 404 for static assets 756439516  
738215487 https://github.com/simonw/datasette/issues/1124#issuecomment-738215487 https://api.github.com/repos/simonw/datasette/issues/1124 MDEyOklzc3VlQ29tbWVudDczODIxNTQ4Nw== simonw 9599 2020-12-03T18:50:26Z 2020-12-03T21:41:25Z OWNER

This fix works - calling .resolve() on the root_path before the comparison to ensure symlinks are resolved: python # Ensure full_path is within root_path to avoid weird "../" tricks try: print("full_path={}, root_path={}".format(full_path, root_path)) full_path.relative_to(root_path.resolve()) except ValueError as e: print(" ValueError:", e) await asgi_send_html(send, "404", 404) return

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Datasette on Amazon Linux on ARM returns 404 for static assets 756439516  
738213342 https://github.com/simonw/datasette/issues/1124#issuecomment-738213342 https://api.github.com/repos/simonw/datasette/issues/1124 MDEyOklzc3VlQ29tbWVudDczODIxMzM0Mg== simonw 9599 2020-12-03T18:46:22Z 2020-12-03T21:40:51Z OWNER

I replaced that function with this code: ```python def asgi_static(root_path, chunk_size=4096, headers=None, content_type=None): async def inner_static(request, send): path = request.scope["url_route"]["kwargs"]["path"] print("path =", path) try: full_path = (Path(root_path) / path).resolve().absolute() except FileNotFoundError as e: print("FileNotFoundError:", e) await asgi_send_html(send, "404", 404) return if full_path.is_dir(): await asgi_send_html(send, "403: Directory listing is not allowed", 403) return # Ensure full_path is within root_path to avoid weird "../" tricks try: print("full_path={}, root_path={}".format(full_path, root_path)) full_path.relative_to(root_path) except ValueError as e: print(" ValueError:", e) await asgi_send_html(send, "404", 404) return try: await asgi_send_file(send, full_path, chunk_size=chunk_size) except FileNotFoundError: await asgi_send_html(send, "404", 404) return

return inner_static

`` Edited usingvi /home/ec2-user/.local/pipx/venvs/datasette/lib/python3.7/site-packages/datasette/utils/asgi.py`

The output shows me what the bug is: $ datasette --get /-/static/app.css --pdb app_root = /home/ec2-user/.local/pipx/venvs/datasette/lib64/python3.7/site-packages path = app.css full_path=/home/ec2-user/.local/pipx/venvs/datasette/lib/python3.7/site-packages/datasette/static/app.css, root_path=/home/ec2-user/.local/pipx/venvs/datasette/lib64/python3.7/site-packages/datasette/static ValueError: '/home/ec2-user/.local/pipx/venvs/datasette/lib/python3.7/site-packages/datasette/static/app.css' does not start with '/home/ec2-user/.local/pipx/venvs/datasette/lib64/python3.7/site-packages/datasette/static' 404 ValueError: '/home/ec2-user/.local/pipx/venvs/datasette/lib/python3.7/site-packages/datasette/static/app.css' does not start with '/home/ec2-user/.local/pipx/venvs/datasette/lib64/python3.7/site-packages/datasette/static'

One is ../lib/python3.7/.. and the other is ../lib64/python3.7/.. - there's clearly some kind of symlink in play here which I'm not taking into account.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Datasette on Amazon Linux on ARM returns 404 for static assets 756439516  
738313399 https://github.com/simonw/datasette/issues/1124#issuecomment-738313399 https://api.github.com/repos/simonw/datasette/issues/1124 MDEyOklzc3VlQ29tbWVudDczODMxMzM5OQ== simonw 9599 2020-12-03T21:10:54Z 2020-12-03T21:10:54Z OWNER

Confirmed that installing a fresh copy of Datasette 0.52.3 on that server works correctly as expected.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Datasette on Amazon Linux on ARM returns 404 for static assets 756439516  
738224865 https://github.com/simonw/datasette/issues/1124#issuecomment-738224865 https://api.github.com/repos/simonw/datasette/issues/1124 MDEyOklzc3VlQ29tbWVudDczODIyNDg2NQ== simonw 9599 2020-12-03T19:01:52Z 2020-12-03T19:01:52Z OWNER

https://github.com/simonw/datasette/runs/1494631261 /home/runner/work/datasette/datasette/tests/test_html.py:81: AssertionError ----------------------------- Captured stderr call ----------------------------- Traceback (most recent call last): File "/home/runner/work/datasette/datasette/datasette/app.py", line 1039, in route_path response = await view(request, send) File "/home/runner/work/datasette/datasette/datasette/utils/asgi.py", line 297, in inner_static full_path.relative_to(root_path.resolve()) AttributeError: 'str' object has no attribute 'resolve'

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Datasette on Amazon Linux on ARM returns 404 for static assets 756439516  
738220067 https://github.com/simonw/datasette/issues/1124#issuecomment-738220067 https://api.github.com/repos/simonw/datasette/issues/1124 MDEyOklzc3VlQ29tbWVudDczODIyMDA2Nw== simonw 9599 2020-12-03T18:58:17Z 2020-12-03T18:58:17Z OWNER

I tested this by running:

pipx uninstall datasette
pipx install 'https://github.com/simonw/datasette/archive/6b4c55efea3e9d34d92cbe5f0066553ad9b14071.zip'

To replace that version of Datasette (in the correct virtual environment) with this patch. It worked!

[ec2-user@ip-172-31-30-7 ~]$ datasette --get /-/static/app.css /* Reset and Page Setup ==================================================== */ ...

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Datasette on Amazon Linux on ARM returns 404 for static assets 756439516  
738211776 https://github.com/simonw/datasette/issues/1124#issuecomment-738211776 https://api.github.com/repos/simonw/datasette/issues/1124 MDEyOklzc3VlQ29tbWVudDczODIxMTc3Ng== simonw 9599 2020-12-03T18:43:21Z 2020-12-03T18:43:21Z OWNER

I'm suspicious of this code here:https://github.com/simonw/datasette/blob/e048791a9a2686f47d81a2c8aa88aa1966d82521/datasette/utils/asgi.py#L284-L307

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Datasette on Amazon Linux on ARM returns 404 for static assets 756439516  
738211152 https://github.com/simonw/datasette/issues/1124#issuecomment-738211152 https://api.github.com/repos/simonw/datasette/issues/1124 MDEyOklzc3VlQ29tbWVudDczODIxMTE1Mg== simonw 9599 2020-12-03T18:42:12Z 2020-12-03T18:42:12Z OWNER

Added a line to print out app_root from https://github.com/simonw/datasette/blob/e048791a9a2686f47d81a2c8aa88aa1966d82521/datasette/app.py#L848-L853 app_root = /home/ec2-user/.local/pipx/venvs/datasette/lib64/python3.7/site-packages

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Datasette on Amazon Linux on ARM returns 404 for static assets 756439516  
738209642 https://github.com/simonw/datasette/issues/1124#issuecomment-738209642 https://api.github.com/repos/simonw/datasette/issues/1124 MDEyOklzc3VlQ29tbWVudDczODIwOTY0Mg== simonw 9599 2020-12-03T18:39:19Z 2020-12-03T18:39:19Z OWNER

The CSS files are in the expected location: [ec2-user@ip-172-31-30-7 ~]$ find /home/ec2-user/.local/pipx/venvs/datasette | grep css /home/ec2-user/.local/pipx/venvs/datasette/lib/python3.7/site-packages/datasette/static/app.css /home/ec2-user/.local/pipx/venvs/datasette/lib/python3.7/site-packages/datasette/static/codemirror-5.57.0.min.css Wow it's running an ANCIENT version of SQLite: [ec2-user@ip-172-31-30-7 ~]$ datasette --get /-/versions.json {"python": {"version": "3.7.9", "full": "3.7.9 (default, Aug 27 2020, 21:58:41) \n[GCC 7.3.1 20180712 (Red Hat 7.3.1-9)]"}, "datasette": {"version": "0.52.2"}, "asgi": "3.0", "uvicorn": "0.12.3", "sqlite": {"version": "3.7.17", "fts_versions": ["FTS4", "FTS3"], "extensions": {}, "compile_options": ["DISABLE_DIRSYNC", "ENABLE_COLUMN_METADATA", "ENABLE_FTS3", "ENABLE_RTREE", "ENABLE_UNLOCK_NOTIFY", "SECURE_DELETE", "TEMP_STORE=1", "THREADSAFE=1"]}} http://www.sqlite.org/releaselog/3_7_17.html - SQLite Release 3.7.17 On 2013-05-20

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Datasette on Amazon Linux on ARM returns 404 for static assets 756439516  

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