Doc Loaded by db:create() has invalid URL according to base-uri()

Friday, 4 February 2022 · 6 messages
EK
Eliot Kimber4 Feb 2022 01:53 #

I think this is a bug:

I’m using db:create() to initialize a database with files from the file system. The OS is linux (but I see the same issue with macOS).

The docs all load without error, but then when processing the loaded content with code that uses base-uri() to get the base URI of a document, I get this failure:

URI '/rome/product/human-resources/task/predict-assignment-group[1].dita' is invalid

Which is correct—the square brackets must be escaped.

However, I didn’t create the URI, BaseX did when it loaded the data, which suggests that there’s a URI escaping action that isn’t being performed when the data is loaded: I would expect the URI to be “predict-assignment-group%5B1%5D.dita” as returned by base-uri() (and as stored in the <resource> entry for the document).

If I do:

collection('/rome/product/human-resources/task/predict-assignment-group[1].dita')/*

I also get invalid collection URI: '/rome/product/human-resources/task/predict-assignment-group[1].dita'

Using db:dir to examine the <resource> entry for the file I see:

<resource raw="false" content-type="application/xml" modified-date="2022-02-03T22:44:29.107Z">predict-assignment-group[1].dita</resource>

So the brackets are not escaped there.

I can use the db:* functions to correct the paths (or just delete the nodes) so not a hard-stop problem.

Cheers,

E. _____________________________________________ Eliot Kimber Sr Staff Content Engineer O: 512 554 9368 M: 512 554 9368 servicenow.com<https://www.servicenow.com> LinkedIn<https://www.linkedin.com/company/servicenow> | Twitter<https://twitter.com/servicenow> | YouTube<https://www.youtube.com/user/servicenowinc> | Facebook<https://www.facebook.com/servicenow>

CG
Christian Grün4 Feb 2022 11:15 #

This is related to an older open issue on GitHub [1]; I hope I can fix it with BaseX 10.

Best, Christian

[1] https://github.com/BaseXdb/basex/issues/1172

Eliot Kimber <eliot.kimber at servicenow.com> schrieb am Fr., 4. Feb. 2022, 01:54:

Quoted text · Eliot Kimber · 84 lines
> I think this is a bug: > > > > I’m using db:create() to initialize a database with files from the file > system. The OS is linux (but I see the same issue with macOS). > > > > The docs all load without error, but then when processing the loaded > content with code that uses base-uri() to get the base URI of a document, I > get this failure: > > *URI > '/rome/product/human-resources/task/predict-assignment-group[1].dita' is > invalid* > > > > Which is correct—the square brackets must be escaped. > > > > However, I didn’t create the URI, BaseX did when it loaded the data, which > suggests that there’s a URI escaping action that isn’t being performed when > the data is loaded: I would expect the URI to be “ > *predict-assignment-group%5B1%5D.dita”* as returned by base-uri() (and as > stored in the <resource> entry for the document). > > > > If I do: > > > > > collection('/rome/product/human-resources/task/predict-assignment-group[1].dita')/* > > > > I also get i*nvalid collection URI: > '/rome/product/human-resources/task/predict-assignment-*group[1].dita' > > > > Using db:dir to examine the <resource> entry for the file I see: > > <resource raw="false" content-type="application/xml" > modified-date="2022-02-03T22:44:29.107Z">predict-assignment-group[1].dita</resource> > > > > So the brackets are not escaped there. > > > > I can use the db:* functions to correct the paths (or just delete the > nodes) so not a hard-stop problem. > > > > Cheers, > > > > E. > > _____________________________________________ > > *Eliot Kimber* > > Sr Staff Content Engineer > > O: 512 554 9368 > > M: 512 554 9368 > > servicenow.com <https://www.servicenow.com> > > LinkedIn <https://www.linkedin.com/company/servicenow> | Twitter > <https://twitter.com/servicenow> | YouTube > <https://www.youtube.com/user/servicenowinc> | Facebook > <https://www.facebook.com/servicenow> >
IL
Imsieke, Gerrit, le-tex4 Feb 2022 11:20 #

Reported by Eliot himself…

Quoted text · Christian Grün · 18 lines
On 04.02.2022 11:15, Christian Grün wrote: > This is related to an older open issue on GitHub [1]; I hope I can fix > it with BaseX 10. > > Best, > Christian > > [1] https://github.com/BaseXdb/basex/issues/1172 > <https://github.com/BaseXdb/basex/issues/1172> > > > > > > Eliot Kimber <eliot.kimber at servicenow.com > <mailto:eliot.kimber at servicenow.com>> schrieb am Fr., 4. Feb. 2022, 01:54: > > I think this is a bug:

…

MG
Maximilian Gärber4 Feb 2022 12:39 #

That feeling when you search stackoverflow to only find your own question from 2 years ago :)

Imsieke, Gerrit, le-tex <gerrit.imsieke at le-tex.de> schrieb am Fr., 4. Feb. 2022, 11:20:

Quoted text · Imsieke, Gerrit, le-tex · 25 lines
> Reported by Eliot himself… > > On 04.02.2022 11:15, Christian Grün wrote: > > This is related to an older open issue on GitHub [1]; I hope I can fix > > it with BaseX 10. > > > > Best, > > Christian > > > > [1] https://github.com/BaseXdb/basex/issues/1172 > > <https://github.com/BaseXdb/basex/issues/1172> > > > > > > > > > > > > Eliot Kimber <eliot.kimber at servicenow.com > > <mailto:eliot.kimber at servicenow.com>> schrieb am Fr., 4. Feb. 2022, > 01:54: > > > > I think this is a bug: > > … > >
EK
Eliot Kimber4 Feb 2022 14:31 #

I thought this issue seemed oddly familiar… 2015 was a long time ago—I can barely remember what I had for breakfast.

A fix would be welcome but clearly it’s not a show stopper…

Cheers,

E.

_____________________________________________ Eliot Kimber Sr Staff Content Engineer O: 512 554 9368 M: 512 554 9368 servicenow.com<https://www.servicenow.com> LinkedIn<https://www.linkedin.com/company/servicenow> | Twitter<https://twitter.com/servicenow> | YouTube<https://www.youtube.com/user/servicenowinc> | Facebook<https://www.facebook.com/servicenow>

Quoted text · BaseX-Talk · 27 lines
From: BaseX-Talk <basex-talk-bounces at mailman.uni-konstanz.de> on behalf of Maximilian Gärber <mgaerber at arcor.de> Date: Friday, February 4, 2022 at 5:39 AM To: Imsieke, Gerrit, le-tex <gerrit.imsieke at le-tex.de>, BaseX <basex-talk at mailman.uni-konstanz.de> Subject: Re: [basex-talk] Doc Loaded by db:create() has invalid URL according to base-uri() [External Email] That feeling when you search stackoverflow to only find your own question from 2 years ago :) Imsieke, Gerrit, le-tex <gerrit.imsieke at le-tex.de<mailto:gerrit.imsieke at le-tex.de>> schrieb am Fr., 4. Feb. 2022, 11:20: Reported by Eliot himself… On 04.02.2022 11:15, Christian Grün wrote: > This is related to an older open issue on GitHub [1]; I hope I can fix > it with BaseX 10. > > Best, > Christian > > [1] https://github.com/BaseXdb/basex/issues/1172<https://urldefense.com/v3/__https:/github.com/BaseXdb/basex/issues/1172__;!!N4vogdjhuJM!VeOvz4uESlLkjVGt2d1IcJeDHKxoztQVyeVYmOqcyQ7EcHpMqGGuyADIJNwGufXyqjLdUA$> > <https://github.com/BaseXdb/basex/issues/1172<https://urldefense.com/v3/__https:/github.com/BaseXdb/basex/issues/1172__;!!N4vogdjhuJM!VeOvz4uESlLkjVGt2d1IcJeDHKxoztQVyeVYmOqcyQ7EcHpMqGGuyADIJNwGufXyqjLdUA$>> > > > > > > Eliot Kimber <eliot.kimber at servicenow.com<mailto:eliot.kimber at servicenow.com> > <mailto:eliot.kimber at servicenow.com<mailto:eliot.kimber at servicenow.com>>> schrieb am Fr., 4. Feb. 2022, 01:54: > > I think this is a bug: …
CG
Christian Grün4 Feb 2022 14:35 #
Quoted text · Eliot Kimber · 1 line
> I thought this issue seemed oddly familiar… 2015 was a long time ago—I can barely remember what I had for breakfast.

True, that piece of information is clearly missing in your bug report ;)


⚡Generated with XQuery