Escaping for paths
thiago.macieira at trolltech.com
Thu Jun 15 12:21:00 PDT 2006
Ross Burton wrote:
>Several applications are writing methods to escape strings so that they
>can be used in object paths (specifically Network Manager does this, and
>eds-dbus has taken code from NM too). EDS is using it so that it can
>return an object path of the
>form /org/gnome/evolution/addressbook/[uri], where obviously the URI
>needs to be escaped.
>I think it would be useful for DBus to contain a function that escaped
>an arbitrary string so that it could be used in an object path to avoid
>this needless wheel re-inventing. Anyone else agree?
I discussed this very issue with another developer yesterday. The issue in
question was bookmarks instead of addressbooks, but it's exactly the same
My conclusion is that we should not provide such a generic method. I
believe it's dangerous. I'd much rather see the applications internally
changed to avoid this kind of problem.
In this example, what I would instead propose is that the object
at /org/gnome/evolution/addressbook provide a method called "FindURI" or
something similar, which would take the URI and return an object path to
the internal object. This would have the added benefit of on-demand
loading, since there's a call before the actual object access.
I also don't believe this kind of functionality belongs in the core
library. Validation? Yes. Escaping? I don't think so.
The reason why I think it's dangerous is that two different URIs or
pathnames could escape to the same object path. For example, imagine I
(that's a Greek alpha and a Greek beta)
Both would escape to /home/thiago/address_book_vcf or
The only solution would be to select one of the characters we have to be
an escape character, like % in URIs. The above example would
and /home/thiago/address_5fbook_2evcf, or
_2fhome_2fthiago_2faddress_5fbook_2evcf. If people push arbitrary data
into this function, it would have the potential to increase the length
Or to completely escape everything (yielding something ugly like:
Thiago José Macieira - thiago.macieira AT trolltech.com
Trolltech ASA - Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 191 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20060615/6b4be933/attachment.pgp
More information about the dbus