I found an issue in Alkacon Formgenerator 2.0 on OpenCms 8.0.2.
I have a form with file fields, with can be submit from Internet Explorer 6.
IE6 set the value as a full path (C:..) with Windows separator "\".
If OpenCms is installed on a server on Linux, le line 1911 in sendMail()
function :
String filename =
attachment.getName().substring(attachment.getName().lastIndexOf(File.sep
arator) + 1);
try to extract the filename with "/"...
So with IE6, the mail received contains attachment with the full path of user's
file!
In my project, I have overload Alkacon classes with a custom jsp, and put this
code:
int index_start_name = 0;
if(attachment.getName().lastIndexOf(File.separator)!=-1){
index_start_name =
attachment.getName().lastIndexOf(File.separator) + 1; }else
if(attachment.getName().lastIndexOf("/")!=-1){
index_start_name =
attachment.getName().lastIndexOf("/") + 1; }else
if(attachment.getName().lastIndexOf("\")!=-1){
index_start_name =
attachment.getName().lastIndexOf("\") + 1; } String filename =
attachment.getName().substring(index_start_name);
I found an issue in Alkacon Formgenerator 2.0 on OpenCms 8.0.2. I have a form with file fields, with can be submit from Internet Explorer 6. IE6 set the value as a full path (C:..) with Windows separator "\". If OpenCms is installed on a server on Linux, le line 1911 in sendMail() function : String filename = attachment.getName().substring(attachment.getName().lastIndexOf(File.sep arator) + 1); try to extract the filename with "/"... So with IE6, the mail received contains attachment with the full path of user's file!
In my project, I have overload Alkacon classes with a custom jsp, and put this code: int index_start_name = 0; if(attachment.getName().lastIndexOf(File.separator)!=-1){ index_start_name = attachment.getName().lastIndexOf(File.separator) + 1; }else if(attachment.getName().lastIndexOf("/")!=-1){ index_start_name = attachment.getName().lastIndexOf("/") + 1; }else if(attachment.getName().lastIndexOf("\")!=-1){ index_start_name = attachment.getName().lastIndexOf("\") + 1; } String filename = attachment.getName().substring(index_start_name);