upload: Attempt to guess character set text/* which are served inline.

This is only `text/plain`, currently.  In such cases where the
client-provided content-type also does not specify a `charset`, we use
`chardet` to make a guess, and store that guess to provide later when
serving the content.  The detection is done in a streaming fashion,
and thus should not require re-downloading the full content.
This commit is contained in:
Alex Vandiver
2025-07-18 05:55:07 +00:00
committed by Tim Abbott
parent ae001dfa96
commit 25fbb05fea
10 changed files with 76 additions and 20 deletions

View File

@@ -204,6 +204,9 @@ prod = [
# For E2EE of push notifications
"pynacl",
# Character set detection for text/plain
"chardet>=5.1.0"
]
docs = [
# Needed to build RTD docs
@@ -274,7 +277,6 @@ dev = [
"SQLAlchemy[mypy]",
"types-beautifulsoup4",
"types-boto",
"types-chardet",
"types-decorator",
"types-defusedxml",
"types-jsonschema",