Project

General

Profile

Feature #2818

Custom HEADER and README filepaths in mod_dirlisting are treated as relative paths instead of absolute paths when file name starts with "/"

Added by abreemen 2 months ago. Updated about 2 months ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
mod_dirlisting
Target version:
Start date:
2017-07-21
Due date:
% Done:

100%

Estimated time:
Missing in 1.5.x:

Description

Description

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.

Solution
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.

Associated revisions

Revision 07e57e24 (diff)
Added by gstrauss about 2 months ago

[mod_dirlisting] treat README and HEADER as paths (fixes #2818)

Treat README and HEADER as filepaths. If absolute path, take as-is.
If relative path, then take relative to directory physical path.

This extends dir-listing.show-header and dir-listing.show-readme
feature to take a filename, which was introduced in lighttpd 1.4.43

x-ref:
"Custom HEADER and README filepaths in mod_dirlisting are treated as relative paths instead of absolute paths when file name starts with '/'"
https://redmine.lighttpd.net/issue/2818

History

#1 Updated by gstrauss about 2 months ago

  • Status changed from New to Patch Pending
  • Target version changed from 1.4.x to 1.4.46

#2 Updated by gstrauss about 2 months ago

  • Status changed from Patch Pending to Fixed
  • % Done changed from 0 to 100

Also available in: Atom