Created attachment 114546 [details] Double extension or wrong extension in picture file upload The IT team has flagged two issues with the picture upload tool (Patron Images feature): 1. The tool allows upload of files with double extension. 2. The tool allows upload of files with arbitrary file extension. In essence, the tool does not validate the image file restriction that is mentioned in the top of upload input tag which is: "Only PNG, GIF, JPEG, XPM formats are supported."
I have tested the following changes to fix both the issues. Need someone to test and approve (I don't have the full environment to submit the patch). /usr/share/koha/intranet/cgi-bin/tools/picture-upload.pl Line: 96++ output_and_exit( $input, $cookie, $template, 'wrong_image_file_ext' ) unless $uploadfilename =~ m/^[^\.]+\.(png|gif|jpg|jpeg|xpm)$/i; /usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/includes/blocking_errors.inc Line: 9++ [% CASE 'wrong_image_file_ext' %] <div class="dialog message">Wrong image file extension or double extension in file name</div>
Resetting to NEW to make this a bit more visible!
When I use the tool, there is a note: NOTE: Only PNG, GIF, JPEG, XPM formats are supported. Maximum image size is 2MB. And if I try to upload a .txt it fails giving a nice error. When I try the same on the patron record, the modal closes without any visible error.