We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug The function isTextFile in src/internal/string_function.go returns false even if the file contains printable characters only.
isTextFile
To Reproduce Steps to reproduce the behavior:
echo "A" > /tmp/test
/tmp
test
Unsupported formats
Expected behavior A normal rendering of the file contents
System information (please complete the following information):
The text was updated successfully, but these errors were encountered:
Screenshots
Fixed the screenshot
Sorry, something went wrong.
I believe the reason for this behavior is that this line will iterate beyond the contents of the file and stop when it encounters the first NULL byte.
A simple fix could be something like the following:
fileInfo, err := file.Stat() if err != nil { return false, err } bufferSize := min(fileInfo.Size(), 1024) reader := bufio.NewReader(file) buffer := make([]byte, bufferSize)
No branches or pull requests
Describe the bug
The function
isTextFile
in src/internal/string_function.go returns false even if the file contains printable characters only.To Reproduce
Steps to reproduce the behavior:
echo "A" > /tmp/test
/tmp
directory and seek to thetest
fileUnsupported formats
errorExpected behavior
A normal rendering of the file contents
System information (please complete the following information):
The text was updated successfully, but these errors were encountered: