| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Signed-off-by: Adrian Braemer <adrian.braemer@tngtech.com>
There was a problem hiding this comment.
Thanks! @abraemer LGTM
Keeping these links here for reference:
There were some formatting test failures, I've fixed them for you (since the tests does not run automatically for first-time contributors).
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Context
On Unix systems, paths may contain arbitrary bytes. This can cause the string encoding to fail if the path contains bytes that are not valid UTF-8 codepoints. I ran into this bug while scanning a large code base with ScanCode. In this circumstance, this bug caused ScanCode to abort entirely and not produce any output.
Summary of changes
This PR add the option "surrogateescape" to the .encode call. This means that bytes that cannot be encoded properly are escaped instead. Since we only use the encoding to convert a string to a byte sequence for hashing, this simple change should be sufficient to fix the problem and does not require further changes.