diff options
author | Patrick Brown <ptbrown@whoopdedo.org> | 2015-07-16 02:50:41 -0400 |
---|---|---|
committer | Patrick Brown <ptbrown@whoopdedo.org> | 2015-07-16 02:50:41 -0400 |
commit | ccee93d9d1aa20ccc91f9277983d7fa2ee34f7f9 (patch) | |
tree | 0ffbf08b5c0f5ff35be43d67dd61596a7f6211ce | |
parent | 282d636f25b71ecb3c37012033d25fd10ba9c83e (diff) | |
download | rpg-ccee93d9d1aa20ccc91f9277983d7fa2ee34f7f9.tar.gz rpg-ccee93d9d1aa20ccc91f9277983d7fa2ee34f7f9.tar.bz2 |
Unit test for interwiki URL encoding bug
-rw-r--r-- | _test/tests/inc/parser/renderer_resolveinterwiki.test.php | 20 | ||||
-rw-r--r-- | conf/interwiki.conf | 2 | ||||
-rw-r--r-- | inc/parser/renderer.php | 2 |
3 files changed, 12 insertions, 12 deletions
diff --git a/_test/tests/inc/parser/renderer_resolveinterwiki.test.php b/_test/tests/inc/parser/renderer_resolveinterwiki.test.php index dd1ed1d3f..9cc3443eb 100644 --- a/_test/tests/inc/parser/renderer_resolveinterwiki.test.php +++ b/_test/tests/inc/parser/renderer_resolveinterwiki.test.php @@ -17,18 +17,18 @@ class Test_resolveInterwiki extends DokuWikiTest { $tests = array( // shortcut, reference and expected - array('wp', 'foo @+%/#txt', 'http://en.wikipedia.org/wiki/foo @+%/#txt'), - array('amazon', 'foo @+%/#txt', 'http://www.amazon.com/exec/obidos/ASIN/foo%20%40%2B%25%2F/splitbrain-20/#txt'), - array('doku', 'foo @+%/#txt', 'http://www.dokuwiki.org/foo%20%40%2B%25%2F#txt'), - array('coral', 'http://example.com:83/path/naar/?query=foo%20%40%2B%25%2F', 'http://example.com.83.nyud.net:8090/path/naar/?query=foo%20%40%2B%25%2F'), + array('wp', 'foo [\\]^`{|}~@+#%?/#txt', 'https://en.wikipedia.org/wiki/foo %7E%5B%5C%5D%5E%60%7B%7C%7D%7E@+%23%25%3F/#txt'), + array('amazon', 'foo [\\]^`{|}~@+#%?/#txt', 'https://www.amazon.com/exec/obidos/ASIN/foo%20%7E%5B%5C%5D%5E%60%7B%7C%7D%7E%40%2B%23%25%3F%2F/splitbrain-20/#txt'), + array('doku', 'foo [\\]^`{|}~@+#%?/#txt', 'https://www.dokuwiki.org/foo%20%7E%5B%5C%5D%5E%60%7B%7C%7D%7E%40%2B%23%25%3F%2F#txt'), + array('coral', 'http://example.com:83/path/naar/?query=foo%20%40%2B%25%3F%2F', 'http://example.com.83.nyud.net:8090/path/naar/?query=foo%20%40%2B%25%3F%2F'), array('scheme', 'ftp://foo @+%/#txt', 'ftp://example.com#txt'), //relative url - array('withslash', 'foo @+%/#txt', '/testfoo%20%40%2B%25%2F#txt'), - array('skype', 'foo @+%/#txt', 'skype:foo @+%/#txt'), + array('withslash', 'foo [\\]^`{|}~@+#%?/#txt', '/testfoo%20%7E%5B%5C%5D%5E%60%7B%7C%7D%7E%40%2B%23%25%3F%2F#txt'), + array('skype', 'foo [\\]^`{|}~@+#%?/#txt', 'skype:foo %7E%5B%5C%5D%5E%60%7B%7C%7D%7E@+%23%25?/#txt'), //dokuwiki id's - array('onlytext', 'foo @+%#txt', DOKU_BASE.'doku.php?id=onlytextfoo#txt'), - array('user', 'foo @+%#txt', DOKU_BASE.'doku.php?id=user:foo#txt'), - array('withquery', 'foo @+%#txt', DOKU_BASE.'doku.php?id=anyns:foo&do=edit#txt') + array('onlytext', 'foo [\\]^`{|}~@+#%?/#txt', DOKU_BASE.'doku.php?id=onlytextfoo#txt'), + array('user', 'foo [\\]^`{|}~@+#%?/#txt', DOKU_BASE.'doku.php?id=user:foo#txt'), + array('withquery', 'foo [\\]^`{|}~@+#%?/#txt', DOKU_BASE.'doku.php?id=anyns:foo&do=edit#txt') ); foreach($tests as $test) { @@ -45,7 +45,7 @@ class Test_resolveInterwiki extends DokuWikiTest { $shortcut = 'nonexisting'; $reference = 'foo @+%/'; $url = $Renderer->_resolveInterWiki($shortcut, $reference); - $expected = 'http://www.google.com/search?q=foo%20%40%2B%25%2F&btnI=lucky'; + $expected = 'https://www.google.com/search?q=foo%20%40%2B%25%2F&btnI=lucky'; $this->assertEquals($expected, $url); } diff --git a/conf/interwiki.conf b/conf/interwiki.conf index 3bfc2ac73..18de535f0 100644 --- a/conf/interwiki.conf +++ b/conf/interwiki.conf @@ -20,7 +20,7 @@ dokubug https://bugs.dokuwiki.org/index.php?do=details&task_id= dokugit https://github.com/splitbrain/dokuwiki/issues/ rfc https://tools.ietf.org/html/rfc man http://man.cx/ -amazon http://www.amazon.com/exec/obidos/ASIN/{URL}/splitbrain-20/ +amazon https://www.amazon.com/exec/obidos/ASIN/{URL}/splitbrain-20/ amazon.de https://www.amazon.de/exec/obidos/ASIN/{URL}/splitbrain-21/ amazon.uk https://www.amazon.co.uk/exec/obidos/ASIN/ paypal https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business= diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php index 35bdd0e3f..d5cc68367 100644 --- a/inc/parser/renderer.php +++ b/inc/parser/renderer.php @@ -806,7 +806,7 @@ class Doku_Renderer extends DokuWiki_Plugin { $url = $this->interwiki[$shortcut]; } else { // Default to Google I'm feeling lucky - $url = 'http://www.google.com/search?q={URL}&btnI=lucky'; + $url = 'https://www.google.com/search?q={URL}&btnI=lucky'; $shortcut = 'go'; } |