| 154 | raise ValueError(message) |
| 155 | |
| 156 | def get_part_charset(self, headers: Headers) -> str: |
| 157 | content_type = headers.get("content-type") |
| 158 | |
| 159 | if content_type: |
| 160 | parameters = parse_options_header(content_type)[1] |
| 161 | ct_charset = parameters.get("charset", "").lower() |
| 162 | |
| 163 | # A safe list of encodings. Modern clients should only send ASCII or UTF-8. |
| 164 | # This list will not be extended further. |
| 165 | if ct_charset in {"ascii", "us-ascii", "utf-8", "iso-8859-1"}: |
| 166 | return ct_charset |
| 167 | |
| 168 | return "utf-8" |
| 169 | |
| 170 | def start_file_streaming(self, event: File, total_content_length: int) -> IO[bytes]: |
| 171 | content_type = event.headers.get("content-type") |