mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Garmin/Zepp OS: Fix HTTP requests on Android < 13
Partially reverts 79a6ee2c9
This commit is contained in:
@@ -6,7 +6,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -18,6 +17,9 @@ public class HttpUtils {
|
||||
// utility class
|
||||
}
|
||||
|
||||
/**
|
||||
* @noinspection CharsetObjectCanBeUsed not supported by SDK 21
|
||||
**/
|
||||
public static Map<String, String> urlQueryParameters(final URL url) {
|
||||
final String query = url.getQuery();
|
||||
if (StringUtils.isBlank(query)) {
|
||||
@@ -28,9 +30,9 @@ public class HttpUtils {
|
||||
for (final String pair : pairs) {
|
||||
final String[] parts = pair.split("=", 2);
|
||||
try {
|
||||
final String key = URLDecoder.decode(parts[0], StandardCharsets.UTF_8);
|
||||
final String key = URLDecoder.decode(parts[0], "UTF-8");
|
||||
if (parts.length == 2) {
|
||||
queryParameters.put(key, URLDecoder.decode(parts[1], StandardCharsets.UTF_8));
|
||||
queryParameters.put(key, URLDecoder.decode(parts[1], "UTF-8"));
|
||||
} else {
|
||||
queryParameters.put(key, "");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user