]> granicus.if.org Git - apache/commitdiff
Merge r1204307 from trunk:
authorEric Covener <covener@apache.org>
Mon, 21 Nov 2011 01:04:58 +0000 (01:04 +0000)
committerEric Covener <covener@apache.org>
Mon, 21 Nov 2011 01:04:58 +0000 (01:04 +0000)
PR39923: Allow AddDescription to work with absolute filesystem paths,
by not adding "*/" to their prefix (intended for relative paths)

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1204309 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/generators/mod_autoindex.c

diff --git a/CHANGES b/CHANGES
index 91db4c5eb941e5041acf39b80aaedd78bb39d0f3..7a6933103bb3c23b4add14df36e6e42d809afdb1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.4.0
 
+  *) mod_autoindex: Allow AddDescription "file" arguments to be an
+     absolute path as previously documented. PR39923 [Eric Covener]
+
   *) mod_cache_disk: Remove the unnecessary intermediate brigade while
      writing to disk. Fixes a problem where mod_disk_cache was leaving
      buckets in the intermediate brigade and not passing them to out on
index b6888673634379722d566c17150cab88a70f39c6..1007b8e7db612fad6ddc6ef1512b4d6c15c2d8d0 100644 (file)
@@ -300,6 +300,7 @@ static const char *add_desc(cmd_parms *cmd, void *d, const char *desc,
     autoindex_config_rec *dcfg = (autoindex_config_rec *) d;
     ai_desc_t *desc_entry;
     char *prefix = "";
+    int is_abspath = ap_os_is_path_absolute(cmd->temp_pool, to);
 
     desc_entry = (ai_desc_t *) apr_array_push(dcfg->desc_list);
     desc_entry->full_path = (ap_strchr_c(to, '/') == NULL) ? 0 : 1;
@@ -307,7 +308,12 @@ static const char *add_desc(cmd_parms *cmd, void *d, const char *desc,
                              || desc_entry->full_path
                              || apr_fnmatch_test(to));
     if (desc_entry->wildcards) {
-        prefix = desc_entry->full_path ? "*/" : "*";
+        if (desc_entry->full_path && !is_abspath) { 
+            prefix = "*/";
+        }
+        else if (WILDCARDS_REQUIRED) { 
+            prefix = "*";
+        }
         desc_entry->pattern = apr_pstrcat(dcfg->desc_list->pool,
                                           prefix, to, "*", NULL);
     }