Return-Path: Delivered-To: apmail-httpd-bugs-archive@httpd.apache.org Received: (qmail 49637 invoked by uid 500); 6 Jan 2003 23:42:10 -0000 Mailing-List: contact bugs-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: "Apache HTTPD Bugs Notification List" Delivered-To: mailing list bugs@httpd.apache.org Received: (qmail 49624 invoked from network); 6 Jan 2003 23:42:10 -0000 Date: 6 Jan 2003 23:43:33 -0000 Message-ID: <20030106234333.8535.qmail@nagoya.betaversion.org> From: bugzilla@apache.org To: bugs@httpd.apache.org Cc: Subject: DO NOT REPLY [Bug 15825] New: - filenames with & in them do not appear in file listing under windows explorer X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15825 filenames with & in them do not appear in file listing under windows explorer Summary: filenames with & in them do not appear in file listing under windows explorer Product: Apache httpd-2.0 Version: 2.0.43 Platform: All OS/Version: All Status: NEW Severity: Normal Priority: Other Component: mod_dav AssignedTo: bugs@httpd.apache.org ReportedBy: lneumann@webct.com If your dav client is windows explorer and you are listing a webdav folder with a file with an & in the name, the name will not be displayed correctly. mod_dav is generating correct XML encoding for the filename so if the file is named "a & b.txt" then it will generate "a%20&%20b.txt" but windows explorer does not recognize this. Instead it wants to get "a%20%26%20b.txt" for this filename. If the function dav_xml_escape_uri is changed as follows the correct filename will be encoded and the listing will work properly in windows explorer. static const char *dav_xml_escape_uri(apr_pool_t *p, const char *uri) { const char *e_uri = ap_escape_uri(p, uri); + const char *scan; + apr_size_t len = 0; + apr_size_t extra = 0; + char *qstr; + char *qscan; + char c; /* check the easy case... */ if (ap_strchr_c(e_uri, '&') == NULL) return e_uri; /* there was a '&', so more work is needed... sigh. */ + for (scan = e_uri; (c = *scan) != '\0'; ++scan, ++len) { + if (c == '&') + extra += 2; /* %26 */ + } - /* - * Note: this is a teeny bit of overkill since we know there are no - * '<' or '>' characters, but who cares. - */ - return ap_xml_quote_string(p, e_uri, 0); + /* nothing to do? */ + if (extra == 0) + return e_uri; + + qstr = apr_palloc(p, len + extra + 1); + for (scan = e_uri, qscan = qstr; (c = *scan) != '\0'; ++scan) { + if (c == '&') { + *qscan++ = '%'; + *qscan++ = '2'; + *qscan++ = '6'; + } + else { + *qscan++ = c; + } + } + + *qscan = '\0'; + return qstr; } --------------------------------------------------------------------- To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org For additional commands, e-mail: bugs-help@httpd.apache.org