aboutcode-org / commoncode

A library of common functions shared in many other AboutCode projects
3 stars 11 forks source link

Make safe filename safe to use on POSIX #44

Closed pombredanne closed 2 years ago

pombredanne commented 2 years ago

This enables handling safe paths treating some extra characters as safe on POSIX. In particular this ensures that we can treat the colon ":" as safe for use in file names on POSIX only. This will allow correct processing of system files in ScanCode.io and ExtractCode

Reference: https://github.com/nexB/extractcode/issues/41 Reference: https://github.com/nexB/scancode.io/issues/407 Reference: https://github.com/nexB/scancode.io/issues/445

pombredanne commented 2 years ago

@JonoYang Do you mind to add a few tests so that we can merge this?

JonoYang commented 2 years ago

@pombredanne I've added some test code that checks to see if portable_filename preserves or replaces the valid POSIX path characters.