Skip to content

[BUG] No base-uri assigned to static context in REST request. #4242

@paulmer

Description

@paulmer

Describe the bug
Scripts executed through the REST interface do not receive a base-uri, breaking any use of resolve-uri to resolve paths relative to the script. See example and output below.

Expected behavior
I'd expect a reasonable value to be set for the base-uri, specifically the path of the script within the database, that's suitable for locating other resources in the database relative to the script. Executing a saved script via the eXist client returns a reasonable value, but executing the same script via the REST interface throws an exception.

To Reproduce
Save the following XQuery in the database with execute permission: (For example, save at /db/demo.xqy)

xquery version "3.0";

resolve-uri('.')

Via the web interface, run the script. The result is an error:

http://localhost:8080/exist/rest/db/demo.xqy

returns

<exception>
<path>/db/demo.xqy</path>
<message>
err:FONS0005 base URI of the static context has not been assigned a value. [at line 3, column 1, source: /db/demo.xqy]
</message>
</exception>

I'd expect /db/demo.xqy to be returned instead.

Context (please always complete the following information):

  • OS: macOS
  • eXist-db version: 6.0.0 and earlier versions
  • Java Version: Java 17

Additional context

  • How is eXist-db installed? JAR installer
  • Any custom changes in e.g. conf.xml? No.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugissue confirmed as bugxqueryissue is related to xquery implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions