Skip to content

Commit

Permalink
Merge branch '6.0.x' into 6.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusdacoregio committed Sep 25, 2023
2 parents fcb88d3 + 1a0b8b7 commit e916e44
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private void writeMetadataToResponse(HttpServletResponse response, Saml2Metadata
String fileName = metadata.getFileName();
String encodedFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.name());
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, String.format(format, fileName, encodedFileName));
response.setContentLength(metadata.getMetadata().length());
response.setContentLength(metadata.getMetadata().getBytes(StandardCharsets.UTF_8).length);
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
response.getWriter().write(metadata.getMetadata());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ public void doFilterWhenCharacterEncodingThenEncodeSpecialCharactersCorrectly()
this.filter.doFilter(this.request, this.response, this.chain);
assertThat(this.response.getCharacterEncoding()).isEqualTo(StandardCharsets.UTF_8.name());
assertThat(this.response.getContentAsString(StandardCharsets.UTF_8)).isEqualTo(generatedMetadata);
assertThat(this.response.getContentLength())
.isEqualTo(generatedMetadata.getBytes(StandardCharsets.UTF_8).length);
}

@Test
Expand Down

0 comments on commit e916e44

Please sign in to comment.