Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid StringBuilder.append(Object) in ContentDisposition #25056

Merged
merged 1 commit into from May 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -39,6 +39,7 @@
* @author Sebastien Deleuze
* @author Juergen Hoeller
* @author Rossen Stoyanchev
* @author Sergey Tsypanov
* @since 5.0
* @see <a href="https://tools.ietf.org/html/rfc6266">RFC 6266</a>
*/
Expand Down Expand Up @@ -436,7 +437,11 @@ private static String escapeQuotationsInFilename(String filename) {
boolean escaped = false;
StringBuilder sb = new StringBuilder();
for (char c : filename.toCharArray()) {
sb.append((c == '"' && !escaped) ? "\\\"" : c);
if (!escaped && c == '"') {
sb.append("\\\"");
} else {
sb.append(c);
}
escaped = (!escaped && c == '\\');
}
// Remove backslash at the end..
Expand Down