-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Fix response header for content served via jekyll serve
#8965
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
Fix response header for content served via jekyll serve
#8965
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thank you! My primary feedback is to consider slimming down the database to just the data we need. More detailed comment left in-line.
emulating Jekyll's DataReader
Co-authored-by: Parker Moore <237985+parkr@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating! I like the smaller list. Oddly... it feels like we're missing some MIME types like text/html which are clearly text-based and would likely . 🤔 Left a comment inline.
File.write(config, output) | ||
log_info "Done! See: #{config.inspect.white}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was initially. =)
But the green in the middle kinda felt like it broke the flow for me.. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)
Yeah. I agree. |
The DB provides the default charset that IANA specified for a MIME type. This code was introduced to fix the bug where a lot of text documents don't have a default charset (which generally means it uses ASCII). I think we found a good solution for adding the charset to files with characters (text files mostly) and remove the charset header from files without characters like WASM. Great work! 👍 |
@jekyllbot: merge +fix |
Ashwin Maroli: Fix response header for content served via `jekyll serve` (#8965) Merge pull request 8965
Backport #8965 for v3.9.x: Fix response header for content served via `jekyll serve`
Summary
Use
script/vendor-mimes
to generate a JSON version of the data used to generatelib/jekyll/mime.types
and use that JSON duringjekyll serve
to determine whethercharset=
has to be injected to the"content-type "
in the response-header.script/vendor-mimes
to generatelib/jekyll/commands/serve/mime_types.json
.script/vendor-mimes
to log statements during runtime.jekyll serve
.lib/jekyll/mime.types
with current data at upstream repository.Context
Closes #8938
Resolves #8936