Open jkrshnmenon opened 2 months ago
Screenshots
Fixed the screenshot
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)
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):