in reply to How do you clean up user specified filenames?

In situations like this, I always see if I can throw a buffer in between the user and the file system. From the information you provided, it sounds like these email templates already exist - so in your script, first read the directory containing the templates and record their names into a hash, with each value given a key such as the name of the file minus the extension (only works if they have the same extension, BTW).

Give the user the names of the keys(the aliases) , not the values (the actual file name).

Now you have created a buffer - instead of allowing the user to directly specify a file, and potentially put some nasty shell code in with it, they can only specify the alias of the file. The actually path is retrieved from the hash when the time comes to open the file.

This is just another way - it's a bit of over-kill, but it does work.

Jeff

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
F--F--F--F--F--F--F--F--
(the triplet paradiddle)
  • Comment on (jeffa) Re: How do you clean up user specified filenames?