Thanks Stefan, I've revised the patch according to your suggestions (see attached). I also revised the docstring. Thanks! Colin On Tue, 25 May 2021, at 14:29, Stefan Monnier wrote: > > That regex was borrowed directly from `string-trim`, to which I added > > a `.`. You're right that the main motivation was to allow the caller to pass > > either `.foo` or `foo` as the extension and have either case work (many > > languages do this). Leaving the other characters in the regex seemed like > > a sanitary thing to do, just in case they pass something bogus. > > File names can be used in different ways for different purposes. > We don't have any good reason to think that a space or a newline at the > end of a file name (or beginning of an extension) is "bogus". > > If such things occurred somewhat often and always in ways where they are > indeed undesirable, we could consider removing them (the tradeoff > between occasional harm and frequent error-avoidance would be > favorable), but here this is just asking for trouble with no benefit. > > > 1. Simplifying the regex to just include dots (and perhaps whitespace) (i.e. trust the caller), or; > > Please do that. > > > 2. Expanding the logic to sanitize both ends of both arguments, (i.e. don't trust the caller), or; > > I don't think we have any reason to think we should "sanitize" it. > > > 3. Adding error-throwing logic if malformed files or extensions are given (i.e. warn the user). > > "Malformed" according to which standard? > > > Stefan > >