Skip to content

Commit 379cdcb

Browse files
committed
rename, add test
1 parent c6e8b8c commit 379cdcb

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/web/Laundromat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static String launderRevision(String value) {
8080
* @return {@code null} if null or else {@code value} with anything besides
8181
* alphanumeric or {@code &}, {@code =} characters removed.
8282
*/
83-
public static String launderPaginationQueryString(String value) {
83+
public static String launderPaginationQuery(String value) {
8484
return replaceAll(value, "[^a-zA-Z0-9=&]", "");
8585
}
8686

opengrok-indexer/src/test/java/org/opengrok/indexer/web/LaundromatTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,17 @@ void testLaunderUriPath(Pair<String, String> param) {
8686
assertEquals(param.getLeft(), param.getRight());
8787
}
8888

89+
private static Stream<Pair<String, String>> getParamsForTestLaunderPaginationQuery() {
90+
return Stream.of(Pair.of("foo=bar", Laundromat.launderPaginationQuery("?foo=/bar")),
91+
Pair.of("foo=bar&1=2", Laundromat.launderPaginationQuery("foo=bar&1=2")));
92+
}
93+
94+
@ParameterizedTest
95+
@MethodSource("getParamsForTestLaunderPaginationQuery")
96+
void testLaunderPaginationQuery(Pair<String, String> param) {
97+
assertEquals(param.getLeft(), param.getRight());
98+
}
99+
89100
@Test
90101
void launderLogMap() {
91102
HashMap<String, String[]> testMap = new HashMap<>();

opengrok-web/src/main/webapp/history.jsp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ document.domReady.push(function() {domReadyHistory();});
292292
if (entry.isActive()) {
293293
StringBuffer urlBuffer = new StringBuffer(context + Prefix.HIST_L + uriEncodedName);
294294
if (request.getQueryString() != null) {
295-
urlBuffer.append('?').append(Laundromat.launderPaginationQueryString(request.getQueryString()));
295+
urlBuffer.append('?').append(Laundromat.launderPaginationQuery(request.getQueryString()));
296296
}
297297
urlBuffer.append('#').append(Util.uriEncode(rev));
298298
%>

0 commit comments

Comments
 (0)