github
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/issues/1238#issuecomment-855270917 | https://api.github.com/repos/simonw/datasette/issues/1238 | 855270917 | MDEyOklzc3VlQ29tbWVudDg1NTI3MDkxNw== | 9599 | 2021-06-05T17:32:29Z | 2021-06-05T17:32:29Z | OWNER | This looks like the cause: https://github.com/simonw/datasette/blob/6e9b07be92905011211d8df7a872fb7c1f2737b2/datasette/app.py#L1087-L1092 Note how `path` is modified... but then we create a new `Request()` that uses the old scope, which has unmodified `scope["path"]` - and then the code later on looks at `request.scope["path"]` when deciding if the request matches: https://github.com/simonw/datasette/blob/afed51b1e36cf275c39e71c7cb262d6c5bdbaa31/datasette/app.py#L1154-L1155 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
813899472 | |
https://github.com/simonw/datasette/issues/1238#issuecomment-855272693 | https://api.github.com/repos/simonw/datasette/issues/1238 | 855272693 | MDEyOklzc3VlQ29tbWVudDg1NTI3MjY5Mw== | 9599 | 2021-06-05T17:45:42Z | 2021-06-05T17:45:42Z | OWNER | Applying this fix worked when I manually tested it: ```diff base_url = self.ds.setting("base_url") if base_url != "/" and path.startswith(base_url): path = "/" + path[len(base_url) :] + scope = dict(scope, path=path, raw_path=path.encode("utf-8")) request = Request(scope, receive) ``` But... the test I wrote still failed. My hunch is that this is because deep within the test framework requests go through `ds.client` which may be applying its own changes relevant to `base_url`: https://github.com/simonw/datasette/blob/6e9b07be92905011211d8df7a872fb7c1f2737b2/datasette/utils/testing.py#L139 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
813899472 | |
https://github.com/simonw/datasette/issues/1238#issuecomment-855278540 | https://api.github.com/repos/simonw/datasette/issues/1238 | 855278540 | MDEyOklzc3VlQ29tbWVudDg1NTI3ODU0MA== | 9599 | 2021-06-05T18:33:25Z | 2021-06-05T18:33:25Z | OWNER | Got the test to pass by ensuring the tests don't accidentally double-rewrite the path. Ran into a new problem: ``` @pytest.mark.asyncio @pytest.mark.parametrize( "prefix,expected_path", [(None, "/asgi-scope"), ("/prefix/", "/prefix/asgi-scope")] ) async def test_client_path(datasette, prefix, expected_path): original_base_url = datasette._settings["base_url"] try: if prefix is not None: datasette._settings["base_url"] = prefix response = await datasette.client.get("/asgi-scope") path = response.json()["path"] > assert path == expected_path E AssertionError: assert '/asgi-scope' == '/prefix/asgi-scope' E - /prefix/asgi-scope E ? ------- E + /asgi-scope ``` That test confirms that messing around with the `base_url` doesn't modify the ASGI scope... but the fix I'm using for this issue DOES modify the ASGI scope. The question raised here is: should the ASGI scope stay unmodified when `base_url` is used? I think it should. It doesn't make sense to obscure the "real" path just to get custom pages to work properly. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
813899472 | |
https://github.com/simonw/datasette/issues/1238#issuecomment-855278998 | https://api.github.com/repos/simonw/datasette/issues/1238 | 855278998 | MDEyOklzc3VlQ29tbWVudDg1NTI3ODk5OA== | 9599 | 2021-06-05T18:37:16Z | 2021-06-05T18:37:16Z | OWNER | Alternative idea: populate `request.scope` with a new `route_path` which is the base-url-stripped version, which we then use for other routing operations. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
813899472 | |
https://github.com/simonw/datasette/pull/1357#issuecomment-855281774 | https://api.github.com/repos/simonw/datasette/issues/1357 | 855281774 | MDEyOklzc3VlQ29tbWVudDg1NTI4MTc3NA== | 22429695 | 2021-06-05T18:59:07Z | 2021-06-05T18:59:07Z | NONE | # [Codecov](https://codecov.io/gh/simonw/datasette/pull/1357?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) Report > Merging [#1357](https://codecov.io/gh/simonw/datasette/pull/1357?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) (1b27643) into [main](https://codecov.io/gh/simonw/datasette/commit/6e9b07be92905011211d8df7a872fb7c1f2737b2?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) (6e9b07b) will **increase** coverage by `0.00%`. > The diff coverage is `100.00%`. [![Impacted file tree graph](https://codecov.io/gh/simonw/datasette/pull/1357/graphs/tree.svg?width=650&height=150&src=pr&token=eSahVY7kw1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison)](https://codecov.io/gh/simonw/datasette/pull/1357?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) ```diff @@ Coverage Diff @@ ## main #1357 +/- ## ======================================= Coverage 91.71% 91.72% ======================================= Files 34 34 Lines 4333 4336 +3 ======================================= + Hits 3974 3977 +3 Misses 359 359 ``` | [Impacted Files](https://codecov.io/gh/simonw/datasette/pull/1357?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) | Coverage Δ | | |---|---|---| | [datasette/utils/testing.py](https://codecov.io/gh/simonw/datasette/pull/1357/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison#diff-ZGF0YXNldHRlL3V0aWxzL3Rlc3RpbmcucHk=) | `95.38% <ø> (ø)` | | | [datasette/app.py](https://c… | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
912394511 | |
https://github.com/simonw/datasette/issues/1356#issuecomment-855282466 | https://api.github.com/repos/simonw/datasette/issues/1356 | 855282466 | MDEyOklzc3VlQ29tbWVudDg1NTI4MjQ2Ng== | 9599 | 2021-06-05T19:05:06Z | 2021-06-05T19:05:06Z | OWNER | Yeah that's a good point. I avoided making them sub-commands because `datasette serve` already supports the multitude of other arguments they also need... but actually that was just me being lazy - I can easily share arguments between multiple functions like I do in `sqlite-utils` itself: https://github.com/simonw/sqlite-utils/blob/d1a372b3006e6cf7d2017b3ddc484bf5c033e45d/sqlite_utils/cli.py#L46 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
910092577 | |
https://github.com/simonw/datasette/pull/1291#issuecomment-855287200 | https://api.github.com/repos/simonw/datasette/issues/1291 | 855287200 | MDEyOklzc3VlQ29tbWVudDg1NTI4NzIwMA== | 9599 | 2021-06-05T19:48:36Z | 2021-06-05T19:48:36Z | OWNER | This is great, thank you. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
849582643 | |
https://github.com/simonw/datasette/issues/1358#issuecomment-855288228 | https://api.github.com/repos/simonw/datasette/issues/1358 | 855288228 | MDEyOklzc3VlQ29tbWVudDg1NTI4ODIyOA== | 9599 | 2021-06-05T19:57:18Z | 2021-06-05T19:57:18Z | OWNER | There's also a security fix I need to make, so I'm not going to block this on wrapping up the work on the new Docker image testing from #1344 before putting out this release. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
912418094 | |
https://github.com/simonw/datasette/issues/1358#issuecomment-855302320 | https://api.github.com/repos/simonw/datasette/issues/1358 | 855302320 | MDEyOklzc3VlQ29tbWVudDg1NTMwMjMyMA== | 9599 | 2021-06-05T22:08:06Z | 2021-06-05T22:08:06Z | OWNER | See #1360 for the security fix. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
912418094 | |
https://github.com/simonw/datasette/issues/1358#issuecomment-855302339 | https://api.github.com/repos/simonw/datasette/issues/1358 | 855302339 | MDEyOklzc3VlQ29tbWVudDg1NTMwMjMzOQ== | 9599 | 2021-06-05T22:08:16Z | 2021-06-05T22:08:16Z | OWNER | Release notes are in, pushing the release now. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
912418094 | |
https://github.com/simonw/datasette/issues/1360#issuecomment-855303649 | https://api.github.com/repos/simonw/datasette/issues/1360 | 855303649 | MDEyOklzc3VlQ29tbWVudDg1NTMwMzY0OQ== | 9599 | 2021-06-05T22:22:06Z | 2021-06-05T22:22:06Z | OWNER | I've released fixes in both 0.56.1 and 0.57. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
912464443 | |
https://github.com/simonw/datasette/issues/1360#issuecomment-855303776 | https://api.github.com/repos/simonw/datasette/issues/1360 | 855303776 | MDEyOklzc3VlQ29tbWVudDg1NTMwMzc3Ng== | 9599 | 2021-06-05T22:23:23Z | 2021-06-05T22:23:23Z | OWNER | Worth noting that I found this issue myself, and to my knowledge it has not been uncovered by anyone else prior to the patch being released. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
912464443 | |
https://github.com/simonw/datasette/issues/1361#issuecomment-855306347 | https://api.github.com/repos/simonw/datasette/issues/1361 | 855306347 | MDEyOklzc3VlQ29tbWVudDg1NTMwNjM0Nw== | 9599 | 2021-06-05T22:49:30Z | 2021-06-05T22:49:30Z | OWNER | Stack Overflow: https://stackoverflow.com/a/49367679/6083 > The answer was that `os.chdir()` had been set to the deleted directory by accident. The directory was missing, but the error happened (it seems) at the attempt to get it with `os.getcwd()`. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
912485040 | |
https://github.com/simonw/datasette/issues/1361#issuecomment-855306497 | https://api.github.com/repos/simonw/datasette/issues/1361 | 855306497 | MDEyOklzc3VlQ29tbWVudDg1NTMwNjQ5Nw== | 9599 | 2021-06-05T22:51:01Z | 2021-06-05T22:51:01Z | OWNER | I'm going to try removing that `restore_working_directory` fixture entirely. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
912485040 | |
https://github.com/simonw/datasette/issues/1361#issuecomment-855307292 | https://api.github.com/repos/simonw/datasette/issues/1361 | 855307292 | MDEyOklzc3VlQ29tbWVudDg1NTMwNzI5Mg== | 9599 | 2021-06-05T22:59:35Z | 2021-06-05T22:59:35Z | OWNER | That broke things. Here's how `pytest-cov` fixed a similar issue: https://github.com/pytest-dev/pytest-cov/commit/7ccb1783bf8290447df58deeb41eae74296a6d9b See also https://github.com/nedbat/coveragepy/issues/881 and https://github.com/pytest-dev/pytest-cov/issues/306 and https://github.com/nedbat/coveragepy/issues/824 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
912485040 | |
https://github.com/simonw/datasette/issues/1361#issuecomment-855308811 | https://api.github.com/repos/simonw/datasette/issues/1361 | 855308811 | MDEyOklzc3VlQ29tbWVudDg1NTMwODgxMQ== | 9599 | 2021-06-05T23:16:21Z | 2021-06-05T23:16:21Z | OWNER | That seems to have fixed it. I'd love to get rid of this `restore_working_directory` hack entirely. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
912485040 | |
https://github.com/simonw/datasette/pull/1291#issuecomment-812815358 | https://api.github.com/repos/simonw/datasette/issues/1291 | 812815358 | MDEyOklzc3VlQ29tbWVudDgxMjgxNTM1OA== | 22429695 | 2021-04-03T05:32:50Z | 2021-06-05T19:48:30Z | NONE | # [Codecov](https://codecov.io/gh/simonw/datasette/pull/1291?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) Report > Merging [#1291](https://codecov.io/gh/simonw/datasette/pull/1291?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) (8789157) into [main](https://codecov.io/gh/simonw/datasette/commit/0a7621f96f8ad14da17e7172e8a7bce24ef78966?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) (0a7621f) will **not change** coverage. > The diff coverage is `n/a`. > :exclamation: Current head 8789157 differs from pull request most recent head 9bf089f. Consider uploading reports for the commit 9bf089f to get more accurate results [![Impacted file tree graph](https://codecov.io/gh/simonw/datasette/pull/1291/graphs/tree.svg?width=650&height=150&src=pr&token=eSahVY7kw1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison)](https://codecov.io/gh/simonw/datasette/pull/1291?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) ```diff @@ Coverage Diff @@ ## main #1291 +/- ## ======================================= Coverage 91.51% 91.51% ======================================= Files 34 34 Lines 4255 4255 ======================================= Hits 3894 3894 Misses 361 361 ``` ------ [Continue to review full report at Codecov](https://codecov.io/gh/simonw/datasette/pull/1291?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comme… | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
849582643 |