Skip to content

Conversation

@ValentinAUCLERC
Copy link

@ValentinAUCLERC ValentinAUCLERC commented Mar 18, 2025

Resolve issue #70

The current function check if "text" or "x-empty" is in the mimetype to determine if it's a binary or not.
We have some files flagged as application/javascript that are considered as binary even if they are not.

This PR correct it by relying on file encoding.
The flaw is that it depends on mbstring (might not be installed everywhere) so the legacy function is still here for fallback.

Providing more reliable solution to check if a file is a binary or not
Still providing the legacy check if mbstring is not installed
Just checking the first chunk to limit memory usage
@dulldusk
Copy link
Owner

Thanks, i will test and merge.

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