Skip to content

Commit

Permalink
Improve URL composition to reduce warnings in log
Browse files Browse the repository at this point in the history
  • Loading branch information
guusdk committed Sep 19, 2024
1 parent 8226bce commit 231d3f1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/org/jivesoftware/site/DiscourseAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public void init(ServletConfig servletConfig) throws ServletException
{
baseUrl = "https://discourse.igniterealtime.org/";
}
if (!baseUrl.endsWith("/")) {
baseUrl = baseUrl + "/";
}

apiKey = servletConfig.getServletContext().getInitParameter("discourse-api-key");

Expand Down Expand Up @@ -76,7 +79,7 @@ private static Long doSimpleQuery(final int queryId, final int lastNumberOfDays)
parameters.put("download", "true");

try {
return restClient.post(baseUrl + "/admin/plugins/explorer/queries/"+queryId+"/run", headers, parameters).getJSONArray("rows").getJSONArray(0).getLong(0);
return restClient.post(baseUrl + "admin/plugins/explorer/queries/"+queryId+"/run", headers, parameters).getJSONArray("rows").getJSONArray(0).getLong(0);
} catch (Throwable t) {
Log.warn("Unable to interact with Discourse's API.", t);
return null;
Expand Down

0 comments on commit 231d3f1

Please sign in to comment.