Skip to content
Permalink
Browse files
[JENKINS-50713] Add forward slash to timestamps URLs
This seems to be the correct URL and without the forward slash some web
servers (e.g. nginx) fail to load the page.

The Jenkins built-in web server was not affected because it redirects to
add the forward slash automatically.
  • Loading branch information
StevenGBrown committed May 7, 2018
1 parent 09fa37d commit 53c91f964ed5be26aa0880c5e1893720da65df17
@@ -61,7 +61,7 @@ public String getPlainTextUrl() {
elapsedParamValue = FormatStringUtils.stripHtmlTags(elapsedParamValue);
elapsedParamValue = FormatStringUtils.trim(elapsedParamValue);

return "timestamps?elapsed=" + elapsedParamValue + "&appendLog";
return "timestamps/?elapsed=" + elapsedParamValue + "&appendLog";
}

/** {@inheritDoc} */
@@ -81,7 +81,7 @@ public String getPlainTextUrl() {
timeParamValue = FormatStringUtils.stripHtmlTags(timeParamValue);
timeParamValue = FormatStringUtils.trim(timeParamValue);

return "timestamps?time="
return "timestamps/?time="
+ timeParamValue
+ (timeZoneId.isPresent() ? "&timeZone=" + timeZoneId.get() : "")
+ "&appendLog"
@@ -51,14 +51,14 @@ public void testApply() {
@Test
public void testGetPlainTextUrl() {
ElapsedTimestampFormat format = new ElapsedTimestampFormat("'<b>'HH:mm:ss.S'</b> '");
assertThat(format.getPlainTextUrl(), is("timestamps?elapsed=HH:mm:ss.S&appendLog"));
assertThat(format.getPlainTextUrl(), is("timestamps/?elapsed=HH:mm:ss.S&appendLog"));
}

/** */
@Test
public void testGetPlainTextUrl_excessWhitespace() {
ElapsedTimestampFormat format = new ElapsedTimestampFormat(" ' <b> ' HH:mm:ss.S ' </b> ' ");
assertThat(format.getPlainTextUrl(), is("timestamps?elapsed=HH:mm:ss.S&appendLog"));
assertThat(format.getPlainTextUrl(), is("timestamps/?elapsed=HH:mm:ss.S&appendLog"));
}

/** */
@@ -156,7 +156,7 @@ public void testGetPlainTextUrl() {
SystemTimestampFormat format =
new SystemTimestampFormat(
"'<b>'HH:mm:ss'</b> '", Optional.<String>absent(), Locale.ENGLISH);
assertThat(format.getPlainTextUrl(), is("timestamps?time=HH:mm:ss&appendLog&locale=en"));
assertThat(format.getPlainTextUrl(), is("timestamps/?time=HH:mm:ss&appendLog&locale=en"));
}

/** */
@@ -165,7 +165,7 @@ public void testGetPlainTextUrl_excessWhitespace() {
SystemTimestampFormat format =
new SystemTimestampFormat(
" ' <b> ' HH:mm:ss ' </b> ' ", Optional.<String>absent(), Locale.ENGLISH);
assertThat(format.getPlainTextUrl(), is("timestamps?time=HH:mm:ss&appendLog&locale=en"));
assertThat(format.getPlainTextUrl(), is("timestamps/?time=HH:mm:ss&appendLog&locale=en"));
}

/** */
@@ -175,7 +175,7 @@ public void testGetPlainTextUrl_withTimeZone() {
new SystemTimestampFormat("'<b>'HH:mm:ss'</b> '", Optional.of("GMT+1"), Locale.ENGLISH);
assertThat(
format.getPlainTextUrl(),
is("timestamps?time=HH:mm:ss&timeZone=GMT+1&appendLog&locale=en"));
is("timestamps/?time=HH:mm:ss&timeZone=GMT+1&appendLog&locale=en"));
}

/** */

0 comments on commit 53c91f9

Please sign in to comment.