ASF Bugzilla – Attachment 20727 Details for
Bug 31490
mod_proxy_ftp renders filenames with spaces badly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Rework the parsing logic of LIST command
apache.31490 (text/plain), 2.26 KB, created by
rahul
on 2007-08-29 07:52:49 UTC
(
hide
)
Description:
Rework the parsing logic of LIST command
Filename:
MIME Type:
Creator:
rahul
Created:
2007-08-29 07:52:49 UTC
Size:
2.26 KB
patch
obsolete
>Index: modules/proxy/mod_proxy_ftp.c >=================================================================== >--- modules/proxy/mod_proxy_ftp.c (revision 570820) >+++ modules/proxy/mod_proxy_ftp.c (working copy) >@@ -504,9 +504,7 @@ > > /* a directory/file? */ > else if (ctx->buffer[0] == 'd' || ctx->buffer[0] == '-' || ctx->buffer[0] == 'l' || apr_isdigit(ctx->buffer[0])) { >- int searchidx = 0; > char *searchptr = NULL; >- int firstfile = 1; > if (apr_isdigit(ctx->buffer[0])) { /* handle DOS dir */ > searchptr = strchr(ctx->buffer, '<'); > if (searchptr != NULL) >@@ -514,22 +512,24 @@ > searchptr = strchr(ctx->buffer, '>'); > if (searchptr != NULL) > *searchptr = ']'; >+ filename = strrchr(ctx->buffer, ' '); >+ *(filename++) = '\0'; >+ } else { >+ /* Assume it is a unix format. Unless we find out using >+ * a SYST at the begining, we do not have a way to know for sure.*/ >+ /* Unix ls -l format: >+ * perm links owner group bytes month day hour:min path >+ */ >+ int cchars = 0; >+ char* f = ctx->buffer; >+ for(cchars = 0; cchars < 8; ++cchars) { >+ f = strchr(f, ' '); >+ while(*(++f) == ' '); >+ } >+ *(f-1) = '\0'; >+ filename = f; > } > >- filename = strrchr(ctx->buffer, ' '); >- *(filename++) = '\0'; >- >- /* handle filenames with spaces in 'em */ >- if (!strcmp(filename, ".") || !strcmp(filename, "..") || firstfile) { >- firstfile = 0; >- searchidx = filename - ctx->buffer; >- } >- else if (searchidx != 0 && ctx->buffer[searchidx] != 0) { >- *(--filename) = ' '; >- ctx->buffer[searchidx - 1] = '\0'; >- filename = &ctx->buffer[searchidx]; >- } >- > /* Append a slash to the HREF link for directories */ > if (!strcmp(filename, ".") || !strcmp(filename, "..") || ctx->buffer[0] == 'd') { > str = apr_psprintf(p, "%s <a href=\"%s/\">%s</a>\n",
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 31490
: 20727