Hi. I would like the dev community to evaluate this simple fix that will enable uploading
of files with underscore chars in the file name when users perform the attach action. Our
user community is quite impressed about the refreshing ease of use and the power,
flexibility in their collaboration work flow made possible by XE. They would like to
escape the tyranny of Microsoft-MOSS as early as possible and the main roadblock to do so
is the stripping of space and underscores from file names which were created in a
MS-Office centric environment.
I am following the XE-324 JIRA issue filed in the context of this behavior. But
considering that it's scope is much broader than the fix I am seeking and the fact
that it does not have anyone assigned, I don't expect the issue to be fixed anytime
soon. So I tried poking into the XE core java code to see what I fix might entail just to
support the underscore char and it seems it would need a single line edit in the clearName
function in XWiki.java file.
Here is my line analysis:
1. When the user hits the Attach button, the action URL associated is
/xwiki/bin/upload....
2. The struts-config file seems to map the upload action to
com.xpn.xwiki.web.UploadAction
3. The action method in
core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/UploadAction.java file calls
getFileName() method which calls clearName() method
4. The clearName method is defined in
core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java in which one of the
modifications being performed is temp = temp.replaceAll("[_':,;\\\\/]",
" ");
5. Just eliminating the underscore from the regular expression character class should
prevent the underscore from getting stripped. Is this analysis correct? If acceptable,
would it get incorporated in the 2.3-M2 or 2.3 final releases? We are trying to get this
fix implemented ourselves to verify it. But it would take us some considerable heavy
lifting to get the development environment up and running such that we might not be able
to validate it before the 2.3 final release.
Thanks for your support.
Regards,
Milind