Commit b8dbfe1a authored by Karsten Loesing's avatar Karsten Loesing
Browse files

Fix links to IP addresses in same /24.

Fixes #27266.
parent dc87c84c
# Changes in version 3.0.1 - 2018-08-??
* Medium changes
- Fix links to IP addresses in same /24.
# Changes in version 3.0.0 - 2018-08-13
* Major changes
......
......@@ -215,7 +215,7 @@ public class ExoneraTorServlet extends HttpServlet {
statusEntries);
} else if (addressesInSameNetwork != null
&& !addressesInSameNetwork.isEmpty()) {
this.writeSummaryAddressesInSameNetwork(out, rb, relayIp,
this.writeSummaryAddressesInSameNetwork(out, rb, requestUrl, relayIp,
requestedDate.asString, langStr, addressesInSameNetwork);
} else {
this.writeSummaryNegative(out, rb, relayIp, requestedDate.asString);
......@@ -464,8 +464,8 @@ public class ExoneraTorServlet extends HttpServlet {
}
void writeSummaryAddressesInSameNetwork(PrintWriter out,
ResourceBundle rb, String relayIp, String timestampStr, String langStr,
List<String> addressesInSameNetwork) {
ResourceBundle rb, String requestUrl, String relayIp, String timestampStr,
String langStr, List<String> addressesInSameNetwork) {
Object[][] panelItems = new Object[addressesInSameNetwork.size()][];
for (int i = 0; i < addressesInSameNetwork.size(); i++) {
String addressInSameNetwork = addressesInSameNetwork.get(i);
......@@ -473,12 +473,12 @@ public class ExoneraTorServlet extends HttpServlet {
String address;
if (addressInSameNetwork.contains(":")) {
address = addressInSameNetwork.replaceAll("[\\[\\]]", "");
link = String.format("/?ip=[%s]&timestamp=%s&lang=%s",
address.replaceAll(":", "%3A"), timestampStr, langStr);
link = String.format("%s?ip=[%s]&timestamp=%s&lang=%s",
requestUrl, address.replaceAll(":", "%3A"), timestampStr, langStr);
address = "[" + address + "]";
} else {
link = String.format("/?ip=%s&timestamp=%s&lang=%s",
addressInSameNetwork, timestampStr, langStr);
link = String.format("%s?ip=%s&timestamp=%s&lang=%s",
requestUrl, addressInSameNetwork, timestampStr, langStr);
address = addressInSameNetwork;
}
panelItems[i] = new Object[] { link, address };
......
......@@ -49,7 +49,7 @@ public class ExoneraTorServletTest {
for (QueryResponse qr : qrs) {
StringWriter sw = new StringWriter();
es.writeSummaryAddressesInSameNetwork(new PrintWriter(sw), rb,
qr.queryAddress, qr.queryDate, "en",
"http://localhost:8080/", qr.queryAddress, qr.queryDate, "en",
Arrays.asList(qr.nearbyAddresses));
String errorMsg = "Test data:" + QueryResponse.toJson(qr)
+ "\nresult:\n" + sw.toString();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment