@@ -82,12 +82,18 @@ func TestRender_ShortLinks(t *testing.T) {
82
82
rawtree := util .URLJoin (AppSubURL , "raw" , "master" )
83
83
url := util .URLJoin (tree , "Link" )
84
84
otherURL := util .URLJoin (tree , "Other-Link" )
85
+ encodedURL := util .URLJoin (tree , "Link%3F" )
85
86
imgurl := util .URLJoin (rawtree , "Link.jpg" )
86
87
otherImgurl := util .URLJoin (rawtree , "Link+Other.jpg" )
88
+ encodedImgurl := util .URLJoin (rawtree , "Link+%23.jpg" )
89
+ notencodedImgurl := util .URLJoin (rawtree , "some" , "path" , "Link+#.jpg" )
87
90
urlUncyclo := util .URLJoin (AppSubURL , "wiki" , "Link" )
88
91
otherURLUncyclo := util .URLJoin (AppSubURL , "wiki" , "Other-Link" )
92
+ encodedURLUncyclo := util .URLJoin (AppSubURL , "wiki" , "Link%3F" )
89
93
imgurlUncyclo := util .URLJoin (AppSubURL , "wiki" , "raw" , "Link.jpg" )
90
94
otherImgurlUncyclo := util .URLJoin (AppSubURL , "wiki" , "raw" , "Link+Other.jpg" )
95
+ encodedImgurlUncyclo := util .URLJoin (AppSubURL , "wiki" , "raw" , "Link+%23.jpg" )
96
+ notencodedImgurlUncyclo := util .URLJoin (AppSubURL , "wiki" , "raw" , "some" , "path" , "Link+#.jpg" )
91
97
favicon := "http://google.com/favicon.ico"
92
98
93
99
test (
@@ -134,4 +140,24 @@ func TestRender_ShortLinks(t *testing.T) {
134
140
"[[Link]] [[Other Link]]" ,
135
141
`<p><a href="` + url + `" rel="nofollow">Link</a> <a href="` + otherURL + `" rel="nofollow">Other Link</a></p>` ,
136
142
`<p><a href="` + urlUncyclo + `" rel="nofollow">Link</a> <a href="` + otherURLUncyclo + `" rel="nofollow">Other Link</a></p>` )
143
+ test (
144
+ "[[Link?]]" ,
145
+ `<p><a href="` + encodedURL + `" rel="nofollow">Link?</a></p>` ,
146
+ `<p><a href="` + encodedURLUncyclo + `" rel="nofollow">Link?</a></p>` )
147
+ test (
148
+ "[[Link]] [[Other Link]] [[Link?]]" ,
149
+ `<p><a href="` + url + `" rel="nofollow">Link</a> <a href="` + otherURL + `" rel="nofollow">Other Link</a> <a href="` + encodedURL + `" rel="nofollow">Link?</a></p>` ,
150
+ `<p><a href="` + urlUncyclo + `" rel="nofollow">Link</a> <a href="` + otherURLUncyclo + `" rel="nofollow">Other Link</a> <a href="` + encodedURLUncyclo + `" rel="nofollow">Link?</a></p>` )
151
+ test (
152
+ "[[Link #.jpg]]" ,
153
+ `<p><a href="` + encodedImgurl + `" rel="nofollow"><img src="` + encodedImgurl + `"/></a></p>` ,
154
+ `<p><a href="` + encodedImgurlUncyclo + `" rel="nofollow"><img src="` + encodedImgurlUncyclo + `"/></a></p>` )
155
+ test (
156
+ "[[Name|Link #.jpg|alt=\" AltName\" |title='Title']]" ,
157
+ `<p><a href="` + encodedImgurl + `" rel="nofollow"><img src="` + encodedImgurl + `" title="Title" alt="AltName"/></a></p>` ,
158
+ `<p><a href="` + encodedImgurlUncyclo + `" rel="nofollow"><img src="` + encodedImgurlUncyclo + `" title="Title" alt="AltName"/></a></p>` )
159
+ test (
160
+ "[[some/path/Link #.jpg]]" ,
161
+ `<p><a href="` + notencodedImgurl + `" rel="nofollow"><img src="` + notencodedImgurl + `"/></a></p>` ,
162
+ `<p><a href="` + notencodedImgurlUncyclo + `" rel="nofollow"><img src="` + notencodedImgurlUncyclo + `"/></a></p>` )
137
163
}
0 commit comments