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/1767#issuecomment-1175396774 | https://api.github.com/repos/simonw/datasette/issues/1767 | 1175396774 | IC_kwDOBm6k_c5GDyGm | 9599 | 2022-07-05T18:56:43Z | 2022-07-05T18:56:43Z | OWNER | Based on https://github.com/python/cpython/blob/3.11/Lib/imghdr.py I'm tempted to say that if the file starts with `b'\211PNG\r\n\032\n'` then it's a PNG, if it starts with `b'GIF8` then it's a GIF, anything else I assume an ICO. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1294641696 | |
https://github.com/simonw/datasette/issues/1767#issuecomment-1175391899 | https://api.github.com/repos/simonw/datasette/issues/1767 | 1175391899 | IC_kwDOBm6k_c5GDw6b | 9599 | 2022-07-05T18:53:07Z | 2022-07-05T18:53:07Z | OWNER | https://www.w3.org/2005/10/howto-favicon suggests that it only needs to be able to identify PNG, GIF or ICO. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1294641696 | |
https://github.com/simonw/datasette/issues/1767#issuecomment-1175388492 | https://api.github.com/repos/simonw/datasette/issues/1767 | 1175388492 | IC_kwDOBm6k_c5GDwFM | 9599 | 2022-07-05T18:51:26Z | 2022-07-05T18:51:26Z | OWNER | I could vendor the necessary parts of `imghdr` - it's pretty tiny: https://github.com/python/cpython/blob/3.11/Lib/imghdr.py | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1294641696 | |
https://github.com/simonw/datasette/issues/1767#issuecomment-1175385249 | https://api.github.com/repos/simonw/datasette/issues/1767 | 1175385249 | IC_kwDOBm6k_c5GDvSh | 9599 | 2022-07-05T18:49:52Z | 2022-07-05T18:49:52Z | OWNER | I could use the `imghdr` standard library module, but frustratingly it's marked as deprecated in Python 3.11! https://docs.python.org/3/library/imghdr.html | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1294641696 | |
https://github.com/simonw/datasette/issues/1767#issuecomment-1175381896 | https://api.github.com/repos/simonw/datasette/issues/1767 | 1175381896 | IC_kwDOBm6k_c5GDueI | 9599 | 2022-07-05T18:48:14Z | 2022-07-05T18:48:50Z | OWNER | Annoyingly it looks like the standard library `mimetypes` module only uses filenames as the clue, it doesn't look at the bytes themselves. I'm using that here: https://github.com/simonw/datasette/blob/9f1eb0d4eac483b953392157bd9fd6cc4df37de7/datasette/utils/asgi.py#L261-L277 https://pypi.org/project/python-magic/ can inspect files, but I don't want to add a whole new dependency just for this one feature. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1294641696 | |
https://github.com/simonw/datasette/issues/1767#issuecomment-1175378678 | https://api.github.com/repos/simonw/datasette/issues/1767 | 1175378678 | IC_kwDOBm6k_c5GDtr2 | 9599 | 2022-07-05T18:45:23Z | 2022-07-05T18:45:23Z | OWNER | The content type thing is a bit weird because usually I'd base that on the file extension, but here the `favicon.ico` file extension doesn't necessarily reflect if the image itself is a PNG or some other thing. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1294641696 | |
https://github.com/simonw/datasette/issues/1767#issuecomment-1175377618 | https://api.github.com/repos/simonw/datasette/issues/1767 | 1175377618 | IC_kwDOBm6k_c5GDtbS | 9599 | 2022-07-05T18:44:08Z | 2022-07-05T18:44:08Z | OWNER | Loading it using the existing templating system would be better I think, since that way both custom installations AND plugins could influence the favicon in the same way that they influence the templates. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1294641696 | |
https://github.com/simonw/datasette/issues/1767#issuecomment-1175377125 | https://api.github.com/repos/simonw/datasette/issues/1767 | 1175377125 | IC_kwDOBm6k_c5GDtTl | 9599 | 2022-07-05T18:43:35Z | 2022-07-05T18:43:35Z | OWNER | I think I want this to be a default feature, not a plugin. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1294641696 | |
https://github.com/simonw/datasette/issues/1767#issuecomment-1175376866 | https://api.github.com/repos/simonw/datasette/issues/1767 | 1175376866 | IC_kwDOBm6k_c5GDtPi | 9599 | 2022-07-05T18:43:12Z | 2022-07-05T18:43:12Z | OWNER | Some options: - Allow `favicon` path to be set in `metadata.yml` somehow, or via a `--setting` - Teach Datasette to check for `templates/favicon.ico` and fall back to the default `static/favicon.png` if that file does not exist - Document how to over-ride the favicon using the existing `--static` mechanism (if that's even possible) - Outsource this to a new plugin Note that I need a way to set the `content_type` correctly too. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1294641696 |