When uploading a file(an image to the dam folder as an example) on CQ5 using CRXDE lite or other UI interface, the system would give an error message if the file being uploaded has invalid characters.
I just found out that [
and ]
are not allowed as part of file names.
But when uploading file using a non-UI interface, SlingPostServlet
for example, the character [
gets replaced with the percent encoding representation(%5D) and no error was generated.
Is there some kind of list/doc that would show which characters are not allowed in CQ5?
I am using CQ5.4
Thank you
The JCR naming restrictions are described in the Repository Model section of the JCR specification.
Specifically, the following characters are not allowed:
(“/”, “:”, “[“, “]”, “|”, “*”)
There is a com.day.cq.commons.jcr.JcrUtil class has a createValidName(title) method which may be able to help you. By default the STANDARD_LABEL_CHAR_MAPPING
will replace all illegal characters with an underscore. It is possible to use the HYPHEN_LABEL_CHAR_MAPPING
to replace with a hyphen using the createValidName(title, labelCharMapping[]) method.