Closed mahadzaryab1 closed 1 month ago
@mahadzaryab1 How did you end up testing your changes on windows?
@kehoecj I ran the code on a Windows 11 VM and I can reproduce the error in v.1.6.0. It seems like in v.1.7.0, adding a trailing whitespace in front will return a Unable to find files
error instead of a nil pointer dereference. The changes in this PR do not return an error on Windows for trailing and leading whitespaces.
v.1.6.0
$ ./validator.exe " C:\Users\mahad\Documents\opensource\config-file-validator\test\fixtures\uppercase-extension\good.YAML"
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x28 pc=0x6d3945]
v.1.7.0
$ ./validator.exe " C:\Users\mahad\Documents\opensource\config-file-validator\test\fixtures\uppercase-extension\good.YAML"
2024/08/15 16:30:00 An error occurred during CLI execution: Unable to find files: CreateFile C:\Users\mahad\Documents\opensource\config-file-validator\test\fixtures\uppercase-extension\good.YAML: The filename, directory name, or volume label syntax is incorrect.
Changes from this PR
./validator.exe " C:\Users\mahad\Documents\opensource\config-file-validator\test\fixtures\uppercase-extension\good.YAML "
✓ C:\Users\mahad\Documents\opensource\config-file-validator\test\fixtures\uppercase-extension\good.YAML
Remove all leading and trailing whitespaces when searching the file system for a path. This PR fixes #158.