summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-02-15 00:25:38 (GMT)
committerIlia Alshanetsky <iliaa@php.net>2005-02-15 00:25:38 (GMT)
commit7ee1fdb657f2a6da65087552e6dda8cf2f4bd1ef (patch)
treec39025b48497d772f6d9941014db6eec149147ec /main
parentb6b3659224087f3fd275febe3c6738bdb7cecda4 (diff)
downloadphp-7ee1fdb657f2a6da65087552e6dda8cf2f4bd1ef.tar.gz
Prune uploaded file names to \ on all OSes, read comments for explanation.
Diffstat (limited to 'main')
-rw-r--r--main/rfc1867.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/main/rfc1867.c b/main/rfc1867.c
index d1b7f99..54f775e 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -1077,11 +1077,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
str_len = strlen(filename);
php_mb_gpc_encoding_converter(&filename, &str_len, 1, NULL, NULL TSRMLS_CC);
}
-#ifdef PHP_WIN32
s = php_mb_strrchr(filename, '\\' TSRMLS_CC);
-#else
- s = filename;
-#endif
if ((tmp = php_mb_strrchr(filename, '/' TSRMLS_CC)) > s) {
s = tmp;
}
@@ -1089,12 +1085,13 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
goto filedone;
}
#endif
-
-#ifdef PHP_WIN32
+ /* The \ check should technically be needed for win32 systems only where
+ * it is a valid path separator. However, IE in all it's wisdom always sends
+ * the full path of the file on the user's filesystem, which means that unless
+ * the user does basename() they get a bogus file name. Until IE's user base drops
+ * to nill or problem is fixed this code must remain enabled for all systems.
+ */
s = strrchr(filename, '\\');
-#else
- s = filename;
-#endif
if ((tmp = strrchr(filename, '/')) > s) {
s = tmp;
}