Skip to content

Conversation

@ryan-williams
Copy link

S3 defaults (some?) files to content-type: binary/octet-stream, and datasette-lite was giving a cryptic "That url could not be loaded" alert.

This adds binary/octet-stream to the list of recognized content-types, as well as a console.warn when an unrecognized content-type is encountered.

@Lewiscowles1986
Copy link
Contributor

Lewiscowles1986 commented Aug 16, 2025

You can override the mime type header for pre-signed URL's in AWS S3

s3.generate_presigned_url(
    "get_object",
    Params={
        "Bucket": "my-bucket",
        "Key": "file.ext",
        "ResponseContentType": "application/octet-stream"
    },
    ExpiresIn=3600
)

This would bypass the non-standard header you are getting.

"application/octet-stream",
"application/x-sqlite3",
"application/vnd.sqlite3",
"binary/octet-stream",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

being able to override this if you host you own instance doesnt seem like the worlds worst option either. If the PR were to pivot to that, I think it would make datasette-lite more pluggable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants