Re: punctuation and path names

The problem, you encountered, is due the the fact, that clients running 
on different operating systems cooperate over WebDAV. Whenever the names 
(or last path-segments) of WebDAV-resources are used as file names on 
the local operating system of the client, you will have to cope with this:
Each operating system has a set of restricted characters, that must not 
be used in file names. Additionally there are still files systems that 
are case insensitive.

In your example:
"Client 16/Red Documents" is a perfectly reasonable (though perfectly 
ugly) file name on windows systems. But "/" is the path separator on 
Unix-like systems (like "\" on windows) and must not be used in file 
names. As there are a lot of operating systems with different 
restrictions, I think it is not possible to to something like an 
automatic translation between these reserved characters.

What you can do:

1. Tell your users, to restrict file names to a secure set, that will 
not cause trouble on any OS. My suggestion is lower-case-ascii, dash, 
underscore, colon and tilde.

2. When a user wants to create a new resource and enters a name, your 
client could check for problematic characters. If it finds one, it 
should prompt the user and explain the problem. Most problematic are 
"/", "\" and ":". But there are probably some more.

3. When your client gets URLs from the server (via PROPFIND Depth 1 for 
example) and creates file names from the last path segment, check for 
characters that are not allowed in file names on the client's OS. It may 
replace them by something ugly. davfs2, running on GNU/Linux, replaces 
all "/" by "slash-", "-slash-" or "-slash". But of course, in 
HTTP-requests, it must use the original URL. So the client has to 
remember the URL.

Will "displayname" help?
No. It is useless nonsense. The WebDAV-specification could never make up 
its mind whether it is a name or a description. Last decision is, that 
it is not required to be unique within one collection and must not be 
used to identify a resource. Why would you present to a user a list of 
resource names, when she cannot identify the resources by these names?

Werner

Received on Tuesday, 27 May 2008 22:14:46 UTC