From 1fc1a5a4a40faeffbb8272493a7ef64658980861 Mon Sep 17 00:00:00 2001 From: Bill Stoddard Date: Mon, 7 May 2001 14:03:59 +0000 Subject: [PATCH] Get mod_cern_meta to work on Windows. The problem was in the "skip leading slash" logic, which is inheriently broken on Windows because full Windows filenames begin with a drive letter or UNC path. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89046 13f79535-47bb-0310-9956-ffa450edef68 --- modules/metadata/mod_cern_meta.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/metadata/mod_cern_meta.c b/modules/metadata/mod_cern_meta.c index 44a1ebae3e..4bb69ec3bc 100644 --- a/modules/metadata/mod_cern_meta.c +++ b/modules/metadata/mod_cern_meta.c @@ -309,6 +309,7 @@ static int scan_meta_file(request_rec *r, apr_file_t *f) static int add_cern_meta_data(request_rec *r) { char *metafilename; + char *leading_slash; char *last_slash; char *real_file; char *scrap_book; @@ -337,10 +338,10 @@ static int add_cern_meta_data(request_rec *r) /* what directory is this file in? */ scrap_book = apr_pstrdup(r->pool, r->filename); - /* skip leading slash, recovered in later processing */ - scrap_book++; + + leading_slash = strchr(scrap_book, '/'); last_slash = strrchr(scrap_book, '/'); - if (last_slash != NULL) { + if ((last_slash != NULL) && (last_slash != leading_slash)) { /* skip over last slash */ real_file = last_slash; real_file++; @@ -354,7 +355,7 @@ static int add_cern_meta_data(request_rec *r) return DECLINED; }; - metafilename = apr_pstrcat(r->pool, "/", scrap_book, "/", + metafilename = apr_pstrcat(r->pool, scrap_book, "/", dconf->metadir ? dconf->metadir : DEFAULT_METADIR, "/", real_file, dconf->metasuffix ? dconf->metasuffix : DEFAULT_METASUFFIX, -- 2.50.1