embedthis/appweb-4 — pull request #3 by jchampio (2012-05-02 15:00:26+00:00)
Title: Fix dirHandler's filename display

The dirHandler was performing subdirectory recursion and listing full paths to files; it now only lists the relative paths to a directory's children.

For example, if the URI /files is mapped to the local directory c:\server\www, then the dirHandler will output a page with links that look like this:

```
* c:\server\www\file0
* c:\server\www\file1
* c:\server\www\folder1\file2
* c:\server\www\folder1\folder2\file3
```

Besides exposing internal directory structure to clients, these links are broken because they're not valid URLs. The problem is that mprGetPathFiles was being called with the flag "1", which corresponds to MPR_PATH_DESCEND. This is probably a holdover from when mprGetPathFiles used to take a boolean value instead of a bitflag (see commit embedthis/mpr-4@2c0452ac81a7f774466ecdacae74d7af4a1b32ad).

With MPR_PATH_RELATIVE, subdirectories are not traversed and the links are correctly displayed.

*Note: I searched for more instances of mprGetPathFiles being called with an integer value, and found two: one in config.c and one in esp/esp.c. Both call mprGetPathFiles with a flag value of zero; it may be worth checking into.*