[RFC] Netx: clean up path sanitization code
omajid at redhat.com
Mon Jun 28 16:47:41 PDT 2010
On 06/24/2010 07:37 PM, Andrew John Hughes wrote:
> On 24 June 2010 17:04, Omair Majid<omajid at redhat.com> wrote:
>> The attached patch does a little bit of refactoring, moving path
>> manipulation functions to a common location.
>> Any comments?
> Looks good. It's more than just cleanup though, as the behaviour of
> sanitizeFileName has changed. It now only replaces ILLEGAL_CHARS and
> not all characters that aren't in the legal set.
Yes, it is more than cleanup. There were two conflicting file
sanitization schemes. One (which sanitized path names) used a
blacklisting approach and only disallowed certain characters. The other
(which sanitized file names) used a whitelisting approach and disallowed
everything except alphanumeric characters. I wrote this code. For the
sake of consistency, we want both sanitization schemes to return the
same file name. There is a problem with the whitelisting approach: it
can not deal with international file names. Hence I am making both the
functions use the black listing approach. Please let me know if there
are any issues I may have missed.
> I'd also make the two arrays private and final.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the distro-pkg-dev