From: Hungerburg 13 <pc...@my...> - 2020-11-24 20:59:55
|
Hello David, Eduard, looks like today I replied to a private message, here the gist of it: > What I am saying is that exist-db uses this constrructor Not everywhere, see https://github.com/eXist-db/exist/blob/10809646b5fc48195185b3399e084fb11e1d7e37/exist-core/src/main/java/org/exist/http/servlets/EXistServlet.java#L205 I wrote that "hack" five years ago, credit got lost sometime, so it seems, but it is still there. The REST interface should therefore cope with them awkward characters? @David, would you make certain? Beware, what you get displayed in a directory listing might not be what has to be sent to the server - web browsers do escaping for transport for you, you might end up double escaping, curl does not, you might up not escaping! Peter PS: @David - It is not that easy to shift the blame around. The problem is in fact partly due to "home grown" conversions, but is very much also in the Java 2EE spec, in how eXist-db gets passed its arguments from the jetty container, which really is an abomination. Am 24.11.20 um 19:20 schrieb David Birnbaum: > Dear exist-open (cc Eduard, Peter), > > Have I understood correctly from the conversation below that eXist-db > uses a broken Java constructor to convert filenames to URIs, that is, a > constructor that incorrectly raises an error when operating on filenames > that contain percent signs and square brackets, even though those > characters can be percent-escaped and the percent-escaped versions can > be used in URIs? If that is the case, this would appear to be a bug in > eXist-db—perhaps a bug inherited from a faulty Java resource, but one > that could be fixed within eXist-db resource management interfaces by > shunning the faulty resource in favor of a (if necessary home-grown) > compliant filename-to-URI conversion routine. Or have I misunderstood > something about how filename-to-URI mapping is supposed to work? I did > consult https://tools.ietf.org/html/rfc3986#section-2, which seems to > tell me that filenames that contain percent signs and square brackets > can be used as URIs by percent-encoding those (and other reserved) > characters. > > Best, > > David > > > On Tue, Nov 24, 2020 at 1:16 AM Eduard Drenth <ed...@fr... > <mailto:ed...@fr...>> wrote: > > What I am saying is that exist-db uses this constrructor > > -----Original Message----- > *From*: Hungerburg 13 <pc...@my... > <mailto:Hungerburg%2013%20%3c...@my...%3e>> > *To*: exi...@li... > <mailto:exi...@li...> > *Subject*: Re: [Exist-open] Filenames with awkward characters in > eXist-db? > *Date*: Mon, 23 Nov 2020 23:27:04 +0100 > > Am 23.11.20 um 22:08 schrieb Eduard Drenth: > >> Another followup on this one: >> >> Under the hood java.net.URI is used, a URI with either % or brackets >> isn't valid, try: >> >> new URI("test%percent.xml"); >> new URI("test[with]brackets.xml"); >> > > Not so quick! You should use another constructor, to work around such > > awkward characters, see attached java source - beware the path string > > then must start with a slash. > > > The error message is somehow misleading though. Perhaps the four > > argument constructor just can do a better guess at what is wanted, URIs > > are quite a complicated beast. > > > Peter |