Skip to content

Commit

Permalink
[JENKINS-50713] Add forward slash to timestamps URLs
Browse files Browse the repository at this point in the history
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 53c91f9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Expand Up @@ -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} */
Expand Down
Expand Up @@ -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"
Expand Down
Expand Up @@ -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"));
}

/** */
Expand Down
Expand Up @@ -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"));
}

/** */
Expand All @@ -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"));
}

/** */
Expand All @@ -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"));
}

/** */
Expand Down

0 comments on commit 53c91f9

Please sign in to comment.