Description
Description of the Problem
The function file:resolve-path( $path )
returns different results depending on whether the specified $path
is an existing directory or not. Namely, it preserves the trailing slash in the first case, and removes it in the second case.
For example, if "/foo/bar" is an existing directory, file:resolve-path( "/foo/bar/" )
returns "/foo/bar/", otherwise it returns "/foo/bar" (i.e., the trailing slash is removed).
This behavior is not specified in the documentaion.
Expected Behavior
In the steps 1 and 3 below the result should be the same.
Steps to Reproduce the Behavior
- Run Xquery
file:resolve-path( "/foo/bar/" )
- Create directory
mkdir -p /foo/bar/
- Run Xquery
file:resolve-path( "/foo/bar/" )
Do you have an idea how to solve the issue?
I think, this function should not depend on existing files.
Regarding normalization, the expected behavior is that a trailing slash is preserved, because file:current-dir()
and file:base-dir()
return the path with a trailing slash, and fn:resolve-uri
preserves the trailing slashes.
Update: According to EXPath File Module 4.0 / file:resolve-path
, "If $path
is an absolute path, it is returned unchanged".
See also: #1176
What is your configuration?
BaseX 11.8 beta a315259