diff options
author | Andreas Gohr <andi@splitbrain.org> | 2011-09-25 09:54:17 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2011-09-25 09:54:17 +0200 |
commit | b680ea06a64290b3e28a7b7d2d8d33373a3e6709 (patch) | |
tree | 60b501fdb1484fae50ca0f0253fb9c1b505372d7 | |
parent | 7e4e38eb0a22e35382c5ef897d7351323e4f4887 (diff) | |
download | rpg-b680ea06a64290b3e28a7b7d2d8d33373a3e6709.tar.gz rpg-b680ea06a64290b3e28a7b7d2d8d33373a3e6709.tar.bz2 |
fix namespace cleaning FS#2295
This patch applies the correct pagename cleaning to namespaces as well.
Namespaces should follow the same rules as pagenames but due to a bug it
was possible to have namespaces ending in a underscore.
If you used such a namespace it will be inaccessible after applying this
patch. You should rename the namespace directory on the filesystem
(removing the trailing underscore). You old links will then work
automatically again. Rebuilding the search index is recommended.
-rw-r--r-- | _test/cases/inc/pageutils_clean_id.test.php | 9 | ||||
-rw-r--r-- | inc/pageutils.php | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/_test/cases/inc/pageutils_clean_id.test.php b/_test/cases/inc/pageutils_clean_id.test.php index 01fa7dc1c..ece71e899 100644 --- a/_test/cases/inc/pageutils_clean_id.test.php +++ b/_test/cases/inc/pageutils_clean_id.test.php @@ -36,6 +36,15 @@ class init_clean_id_test extends UnitTestCase { $tests[] = array('page:page',false,'page:page'); $tests[] = array('page;page',false,'page:page'); + $tests[] = array('page._#!','false','page'); + $tests[] = array('._#!page','false','page'); + $tests[] = array('page._#!page','false','page._page'); + $tests[] = array('ns._#!:page','false','ns:page'); + $tests[] = array('ns:._#!page','false','ns:page'); + $tests[] = array('ns._#!ns:page','false','ns._ns:page'); + $tests[] = array('ns_:page',false,'ns:page'); + $tests[] = array('page...page','false','page...page'); + $conf['useslash'] = 0; $tests[] = array('page/page',false,'page_page'); diff --git a/inc/pageutils.php b/inc/pageutils.php index 81dcb66e7..31b5f9ff9 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -134,6 +134,7 @@ function cleanID($raw_id,$ascii=false,$media=false){ $id = preg_replace('#:+#',':',$id); $id = ($media ? trim($id,':.-') : trim($id,':._-')); $id = preg_replace('#:[:\._\-]+#',':',$id); + $id = preg_replace('#[:\._\-]+:#',':',$id); $cache[(string)$raw_id] = $id; return($id); |