File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
src/fitnesse/responders/search
test/fitnesse/responders/search Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 5
5
import java .util .regex .Pattern ;
6
6
7
7
import fitnesse .components .TraversalListener ;
8
+ import fitnesse .html .HtmlUtil ;
8
9
import fitnesse .wiki .WikiPage ;
9
10
import fitnesse .wiki .search .PageFinder ;
10
11
import fitnesse .wiki .search .RegularExpressionWikiPageFinder ;
@@ -29,7 +30,7 @@ private String getSearchType() {
29
30
return "Content" ;
30
31
}
31
32
32
-
33
+
33
34
protected String getPageFooterInfo (int hits ) {
34
35
return "Found " + hits + " results for your search." ;
35
36
}
@@ -41,7 +42,9 @@ protected String getTemplate() {
41
42
42
43
@ Override
43
44
protected String getTitle () {
44
- return (request .getInput ("searchType" ) == null ) ? "Search Form" : getSearchType () + " Search Results for '" + getSearchString () + "'" ;
45
+ return (request .getInput ("searchType" ) == null )
46
+ ? "Search Form"
47
+ : getSearchType () + " Search Results for '" + HtmlUtil .escapeHTML (getSearchString ()) + "'" ;
45
48
}
46
49
47
50
@ Override
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ public void testNoSearchStringBringsUpNoResults() throws Exception {
76
76
@ Test
77
77
public void testEscapesSearchString () throws Exception {
78
78
String content = getResponseContentUsingSearchString ("!+-<&>" );
79
- assertSubString ("!+-<& >" , content );
79
+ assertSubString ("<title>Content Search Results for ' !+-<&>'</title >" , content );
80
80
}
81
81
82
82
private String getResponseContentUsingSearchString (String searchString ) throws Exception {
You can’t perform that action at this time.
0 commit comments