jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Furio De Nardis <fdenar...@hotmail.com>
Subject Re: Error creating file with square brackets in filename
Date Mon, 17 May 2010 06:59:53 GMT


Kevin Jansz <kevin.jansz <at> exari.com> writes:

> 
> On trying to PUT a file over webdav that has square brackets (ie '[' &
> ']') in its name I get a "500 Internal Server Error".
> 
> Trying to create the file using the JCR API:
> file = folder.addNode("[Content_Types].xml", JcrConstants.NT_FILE);
> 
> Gives a bit more information:
>         ...
> Caused by: 
org.apache.jackrabbit.spi.commons.conversion.MalformedPathException:
> '[Content_Types].xml' is not a valid path: Unterminated identifier
> segment.
> 	at 
org.apache.jackrabbit.spi.commons.conversion.PathParser.parse(PathParser.java:29
5)
> 	at 
org.apache.jackrabbit.spi.commons.conversion.PathParser.parse(PathParser.java:12
0)
> 	at 
org.apache.jackrabbit.spi.commons.conversion.ParsingPathResolver.getQPath(Parsin
gPathResolver.java:90)
> 	at 
org.apache.jackrabbit.spi.commons.conversion.CachingPathResolver.getQPath(Cachin
gPathResolver.java:98)
> 	at 
org.apache.jackrabbit.spi.commons.conversion.CachingPathResolver.getQPath(Cachin
gPathResolver.java:77)
> 	at 
org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver.getQPath(De
faultNamePathResolver.java:82)
> 	at org.apache.jackrabbit.core.SessionImpl.getQPath(SessionImpl.java:729)
> 	at 
org.apache.jackrabbit.core.NodeImpl.addNodeWithUuid(NodeImpl.java:2038)
> 	... 15 more
> 
> So it seems that square brackets may need special handling/escaping?
> In this case we don't have the ability to choose a different/better
> name - '[Content_Types].xml' is a resource in all Open Office XML
> (docx) files ...
> 
> Any comments/suggestions/work-arounds would be much appreciated.
> 
> Kevin
> 
> --
> Kevin Jansz
> kevin.jansz <at> exari.com
> Level 7, 10-16 Queen Street, Melbourne 3000 Australia
> Tel +61 3 9621 2773 | Fax +61 3 9621 2776
> Exari Systems
> Boston | London | Melbourne | Munich
> www.exari.com
> 
> Test drive our software online - www.exari.com/demo-trial.html
> Read our blog on document assembly - blog.exari.com
> 
> 


Kevin,

I believe that square brackets are used in JCR paths to address multivalued 
properties and same name siblings. 
I don't know about a "standard" way to escape them, but, if I understand your 
scenario, you may choose your own "escape" sequence, provided that you restore 
the original filename when returning it to the user/client.

Hope it helps,
Furio.


Mime
View raw message