From d91c0c5bb330d87f3106d59d9eacd0c6421343e8 Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Thu, 21 Nov 2002 23:53:21 +0000 Subject: [PATCH] mod_autoindex: AddDescription directives for directories now work as in Apache 1.3, where no trailing '/' is specified on the directory name. Previously, the trailing '/' *had* to be specified, which was incompatible with Apache 1.3. PR: 7990 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97590 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 6 ++++++ modules/generators/mod_autoindex.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/CHANGES b/CHANGES index 3f1e9e06aa..0e6c4e1e0d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,11 @@ Changes with Apache 2.0.44 + *) mod_autoindex: AddDescription directives for directories + now work as in Apache 1.3, where no trailing '/' is + specified on the directory name. Previously, the trailing + '/' *had* to be specified, which was incompatible with + Apache 1.3. PR 7990 [Jeff Trawick] + *) Fix for PR 14556. The expiry calculations in mod_cache were trying to perform "now + ((date - lastmod) * factor)" where date == lastmod resulting in "now + 0". The code now follows diff --git a/modules/generators/mod_autoindex.c b/modules/generators/mod_autoindex.c index 3e3eef4669..defc0c05fe 100644 --- a/modules/generators/mod_autoindex.c +++ b/modules/generators/mod_autoindex.c @@ -1321,6 +1321,14 @@ static struct ent *make_autoindex_entry(const apr_finfo_t *dirent, return (NULL); } + if (rr->finfo.filetype == APR_DIR) { + /* ap_sub_req_lookup_dirent() adds '/' to end of any directory, + * but that messes up our attempt to find relevant + * AddDescription directives. + */ + rr->filename[strlen(rr->filename) - 1] = '\0'; + } + p = (struct ent *) apr_pcalloc(r->pool, sizeof(struct ent)); if (dirent->filetype == APR_DIR) { p->name = apr_pstrcat(r->pool, dirent->name, "/", NULL); -- 2.40.0