Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws s3 type inference should supply a charset for text/ mime types #8574

Open
2 tasks done
couling opened this issue Mar 12, 2024 · 0 comments
Open
2 tasks done

aws s3 type inference should supply a charset for text/ mime types #8574

couling opened this issue Mar 12, 2024 · 0 comments
Labels
feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged.

Comments

@couling
Copy link

couling commented Mar 12, 2024

Describe the feature

Some commands under aws s3 will set a mime type while uploading files. This is based on a type inference system. When the type inference system results in a type starting with text/ it should try to append ; charst=<charset> or at least offer the option to do so.

There's a number of ways this might be inferred and I'm agnostic as to which:

  • Use environment variables provided by the system
  • Add an explicit switch to set the charset
  • Try to guess the charset based on content

Use Case

Where an S3 backed cloud-front website may serve plain text files, there is no other way to indicate the charset of the file. As it stands, the current behaviour forces clients to assume US-ASKII or ISO-8859-1 and this is very rarely right.

RFC 2854 Section 6

The use of an explicit charset parameter is strongly recommended. While [MIME] specifies "The default character set, which must be assumed in the absence of a charset parameter, is US-ASCII."

As it stands the only way to achieve this is to completely bypass the type inference system which means users are left to build their own inference system.

By allowing the client set set a charset for either all text/* types or otherwise specifically set charset for specific mime types such as text/plain, these can then be set correctly in S3 and thus be correct when retrieved through cloud-front.

Proposed Solution

Add an option to set the charset explicitly for text types, or alternatively add an option to infer the charset from the current console's environment variables. This would append ; charset=... to each text mime type. Eg: text/plain; charset=utf-8.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CLI version used

2.15.24

Environment details (OS name and version, etc.)

Macos / Linux

@couling couling added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant