Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package org.springframework.boot.opentelemetry.autoconfigure;

import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.LinkedHashMap;
Expand Down Expand Up @@ -71,7 +70,7 @@ private static String percentDecode(String value) {
if (value.indexOf('%') == -1) {
return value;
}
return URLDecoder.decode(value, StandardCharsets.UTF_8);
return StringUtils.uriDecode(value, StandardCharsets.UTF_8);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ void shouldHandleWhitespaceAroundDelimiters() {

@Test
void shouldPercentDecodeValues() {
Map<String, String> result = W3CHeaderParser.parse("serverNode=DF%2028,userId=Am%C3%A9lie");
assertThat(result).containsExactly(Map.entry("serverNode", "DF 28"), Map.entry("userId", "Amélie"));
Map<String, String> result = W3CHeaderParser
.parse("serverNode=DF%2028,userId=Am%C3%A9lie,application=%20spring+boot%20");
assertThat(result).containsExactly(Map.entry("serverNode", "DF 28"), Map.entry("userId", "Amélie"),
Map.entry("application", " spring+boot "));
}

@Test
Expand Down
Loading