Skip to content

Commit 9be4859

Browse files
author
Vladimir Kotal
committed
fix unknown prefix handling, add /js
1 parent 6ce134b commit 9be4859

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ public enum Prefix {
7979
/** Monitoring. */
8080
METRICS("/metrics"),
8181
/** CSS and images. */
82-
STATIC("/default");
82+
STATIC("/default"),
83+
/** JavaScript. */
84+
JS("/js");
8385

8486
private final String prefix;
8587
Prefix(String prefix) {

opengrok-web/src/main/java/org/opengrok/web/StatisticsFilter.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@ private void measure(HttpServletResponse httpResponse, HttpServletRequest httpRe
8080
if (isRoot(httpReq)) {
8181
category = "root";
8282
} else {
83-
category = config.getPrefix().toString().substring(1);
83+
String prefix = config.getPrefix().toString();
84+
if (prefix.isEmpty()) {
85+
category = "unknown";
86+
} else {
87+
category = prefix.substring(1);
88+
}
8489
}
8590

8691
Timer categoryTimer = Timer.builder("requests.latency").

0 commit comments

Comments
 (0)