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