jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Angela Schreiber <anch...@day.com>
Subject Re: Error creating file with square brackets in filename
Date Thu, 20 May 2010 13:00:38 GMT
Kevin Jansz wrote:
> thank you for that ... it makes sense. For the JCR API, it should be:
> file = folder.addNode(
>       org.apache.jackrabbit.util.Text.escapeIllegalJcrChars("[Content_Types].xml")
>     , JcrConstants.NT_FILE);
> // which becomes "%5BContent_Types%5D.xml"
> 
> 
> I would have expected the WebDAV servlet to be doing the same - [ and
> ] are (arguably) valid chars for use in a filename (on windows, but I
> believe *nix as well).
>>>From http://support.microsoft.com/kb/177506, a filename can't contain
> \ / : * ? " < > | ... (and square brackets are included in the list of
> special characters allowed in filenames).
> the issue for the WebDAV servlet is it's presenting a folders and
> files view of the underlying JCR store. It could handle the
> escaping/unescaping JCR-illegal characters (assuming the webdav client
> has correctly URI encoded the request - which is the case in my test).
> It's actually only [ and ] that seem to fall into the non-JCR name
> category but (arguably) valid filename category.

in the webdav server code there is interface called ResourceLocator
that handles the mapping vom DAV resource path to JCR repository
path back. you may use a custom implementation that does the escaping
according to your needs [see also JCR-184].

regards
angela

> 
> --
> Kevin Jansz
> kevin.jansz@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
> 
> 
> 
> 
> On 17 May 2010 21:06, Alexander Klimetschek <aklimets@day.com> wrote:
>> On Mon, May 17, 2010 at 08:59, Furio De Nardis <fdenardis@hotmail.com> wrote:
>>> I believe that square brackets are used in JCR paths to address multivalued
>>> properties and same name siblings.
>> Same name siblings only. You can't directly access a value in a
>> multivalue property, only the property itself.
>>
>>> 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.
>> Just to complete the discussion, here is the specification (identical
>> for JCR 1.0 and 2.0):
>>
>> Illegal characters for node names:
>> http://www.day.com/specs/jcr/2.0/3_Repository_Model.html#NamingRestrictions
>>
>> And the escaping rules:
>> http://www.day.com/specs/jcr/2.0/3_Repository_Model.html#ExposingNonJCRNames
>>
>> which are implemented by Text.escapeIllegalJcrChars(String), as
>> mentioned already.
>>
>> Regards,
>> Alex
>>
>> --
>> Alexander Klimetschek
>> alexander.klimetschek@day.com
>>
> 


Mime
View raw message