Custom HEADER and README filepaths in mod_dirlisting are treated as relative paths instead of absolute paths when file name starts with "/"
We use mod_dirlisting to list the contents of a connected USB drive. The document root in lighttpd.conf is set to "/www/usb" wich is the mounting location for the USB drive. To style the dirlisting page we use a custom HEADER.txt and README.txt. These files currently have to be placed on the root of the USB Storage and in each subdirectory.
We are currently designing a solution where anyone could place files and directories on the USB Storage. Therefore we want to deliver HEADER.txt and README.txt from an external directory, not placed on the USB Storage. Since 1.4.43 lighttpd supports custom file names for HEADER and README, but the file path is still relative to the current (listed) directory. The goal is to serve these HEADER/README files from a directory in the internal storage, rather than the current listed directory.
Without a patch for mod_dirlisting I need to use a relative path like "../../../../../../../../www/HEADER.txt" for the header file to ensure it's working for at least 7 levels deep. When you enter the 8th subfolder, lighttpd can't find the file anymore.
When the custom dir-listing.show-header or dir-listing.show-readme setting starts with an "/", treat it as an absolute path. When it doesn't, append the value to the current directory (current behaviour).
After applying this patch lighttpd built succesfully and the HEADER.txt and README.txt are working for infinite subfolders.
Also available in: Atom