diff --git a/includes/common.inc b/includes/common.inc index b6ea297..b4cb38f 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -608,7 +608,8 @@ function drupal_parse_url($url) { /** * Encodes a Drupal path for use in a URL. * - * For aesthetic reasons slashes are not escaped. + * For aesthetic reasons slashes, commas and pluses are not escaped. Commas and + * pluses can be used as separators in taxonomy URLs. * * Note that url() takes care of calling this function, so a path passed to that * function should not be encoded in advance. @@ -617,7 +618,10 @@ function drupal_parse_url($url) { * The Drupal path to encode. */ function drupal_encode_path($path) { - return str_replace('%2F', '/', rawurlencode($path)); + return str_replace( + array('%2F', '%2C', '%2B'), + array('/', ',', '+'), + rawurlencode($path)); } /** diff --git a/modules/simpletest/tests/file.test b/modules/simpletest/tests/file.test index dc12b1b..11a39a1 100644 --- a/modules/simpletest/tests/file.test +++ b/modules/simpletest/tests/file.test @@ -2259,10 +2259,13 @@ class FileDownloadTest extends FileTestCase { // Tilde (~) is excluded from this test because it is encoded by // rawurlencode() in PHP 5.2 but not in PHP 5.3, as per RFC 3986. // @see http://www.php.net/manual/en/function.rawurlencode.php#86506 - $basename = " -._!$'\"()*@[]?&+%#,;=:\n\x00" . // "Special" ASCII characters. + // Comma (,) and plus (+) are used as AND and OR operators on taxonomy + // pages, they are left unencoded for aesthetic reason. + // @see http://drupal.org/node/113035 + $basename = " -._+,!$'\"()*@[]?&%#;=:\n\x00" . // "Special" ASCII characters. "%23%25%26%2B%2F%3F" . // Characters that look like a percent-escaped string. "éøïвβ中國書۞"; // Characters from various non-ASCII alphabets. - $basename_encoded = '%20-._%21%24%27%22%28%29%2A%40%5B%5D%3F%26%2B%25%23%2C%3B%3D%3A__' . + $basename_encoded = '%20-._+,%21%24%27%22%28%29%2A%40%5B%5D%3F%26%25%23%3B%3D%3A__' . '%2523%2525%2526%252B%252F%253F' . '%C3%A9%C3%B8%C3%AF%D0%B2%CE%B2%E4%B8%AD%E5%9C%8B%E6%9B%B8%DB%9E';