Re: file upload name filtering
Greg Huber <[email protected]> Sun, 9 Feb 2025 09:20:17 +0000
| Newsgroups | gmane.comp.jakarta.struts.devel |
|---|---|
| Message-ID | <[email protected]> |
Still using v6 at the moment, but I think v7 (dev box) is the same? On 09/02/2025 09:14, Lukasz Lenart wrote: > niedz., 9 lut 2025 o 10:10 Greg Huber<[email protected]> napisał(a): >> I have now had a few uploads blocked mainly due to sentence punctuation >> in the image name ie apostrophe and ampersand symbols. >> >> It would be better here to just escape the string and warn rather than >> just block it, requiring the user to remove the characters is a waste of >> time as this can easily be done in the code. >> >> Most apps would/should be sanitizing upload file names especially in >> downloaded images. Rather than an alphanumeric replace this works well >> for ascii (I have had many attempts at this🙁) >> >> Normalizer.normalize(fileName, >> Normalizer.Form.NFD).replaceAll("([^\\p{ASCII}])", ""); > Is this Struts 7 based app? I ask because I would like to focus on > supporting only the main branch. > > > Cheers > Łukasz > > --------------------------------------------------------------------- > To unsubscribe, e-mail:[email protected] > For additional commands, e-mail:[email protected] >