Search logic with "stat"
You must take the type of directory, explicit vs implicit, into consideration when working with the "stat" action.
Implicit directories
By default, only explicit directories are checked by stat
. Append implicit=yes
to the action header to target implicit directories.
Explicit directories
The stat
action’s search logic for an explicit directory is dependent on how the [path
] variable is defined, whether or not it ends in a trailing slash - “/”.
-
The specified [path] ends with a slash "/"
- The system searches the exact
[path]
given. - The system returns response output with the trailing slash in the entry’s
name
attribute. - If nothing is found, a “404 Error” is returned.
- The system searches the exact
-
The specified [path] does not end with a slash "/"
- The system will search the exact
[path]
given. If a “file” or “symlink” is located, astat
record for it is returned. If not, go to “b)”. - The system re-performs the search, with a trailing slash appended to the specified
[path]
, in which the following could result:- If a directory is found. Return the
stat
record in the response output, without the trailing slash in the entry’sname
attribute. - If a file or symlink is found. Return the
stat
record in the response output, without the trailing slash in thename
attribute, withtype=“dir”
andimplicit=“yes”
.
- If a directory is found. Return the
- If nothing is found, return a “404 Error.”
- The system will search the exact