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 "/"

    1. The system searches the exact [path] given.
    2. The system returns response output with the trailing slash in the entry’s name attribute.
    3. If nothing is found, a “404 Error” is returned.
  • The specified [path] does not end with a slash "/"

    1. The system will search the exact [path] given. If a “file” or “symlink” is located, a stat record for it is returned. If not, go to “b)”.
    2. 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’s name attribute.
      • If a file or symlink is found. Return the stat record in the response output, without the trailing slash in the name attribute, with type=“dir” and implicit=“yes”.
    3. If nothing is found, return a “404 Error.”