Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
ccee93d9
Commit
ccee93d9
authored
9 years ago
by
Patrick Brown
Browse files
Options
Downloads
Patches
Plain Diff
Unit test for interwiki URL encoding bug
parent
282d636f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
_test/tests/inc/parser/renderer_resolveinterwiki.test.php
+10
-10
10 additions, 10 deletions
_test/tests/inc/parser/renderer_resolveinterwiki.test.php
conf/interwiki.conf
+1
-1
1 addition, 1 deletion
conf/interwiki.conf
inc/parser/renderer.php
+1
-1
1 addition, 1 deletion
inc/parser/renderer.php
with
12 additions
and
12 deletions
_test/tests/inc/parser/renderer_resolveinterwiki.test.php
+
10
−
10
View file @
ccee93d9
...
...
@@ -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'
,
'http
s
://en.wikipedia.org/wiki/foo
%7E%5B%5C%5D%5E%60%7B%7C%7D%7E@+%23%25%3F
/#txt'
),
array
(
'amazon'
,
'foo
[\\]^`{|}~@+#%?
/#txt'
,
'http
s
://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'
,
'http
s
://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
=
'http
s
://www.google.com/search?q=foo%20%40%2B%25%2F&btnI=lucky'
;
$this
->
assertEquals
(
$expected
,
$url
);
}
...
...
This diff is collapsed.
Click to expand it.
conf/interwiki.conf
+
1
−
1
View file @
ccee93d9
...
...
@@ -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
http
s
://
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
&
amp
;
business
=
...
...
This diff is collapsed.
Click to expand it.
inc/parser/renderer.php
+
1
−
1
View file @
ccee93d9
...
...
@@ -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
=
'http
s
://www.google.com/search?q={URL}&btnI=lucky'
;
$shortcut
=
'go'
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment