mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Use StandardCharsets.UTF_8
This commit is contained in:
parent
8a86f250ec
commit
d94a7511dd
2 changed files with 6 additions and 20 deletions
|
@ -124,6 +124,7 @@ import java.io.OutputStream;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
|
@ -857,7 +858,7 @@ public class Manager implements Closeable {
|
||||||
String packId = messageSender.uploadStickerManifest(manifest, packKey);
|
String packId = messageSender.uploadStickerManifest(manifest, packKey);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return new URI("https", "signal.art", "/addstickers/", "pack_id=" + URLEncoder.encode(packId, "utf-8") + "&pack_key=" + URLEncoder.encode(Hex.toStringCondensed(packKey), "utf-8"))
|
return new URI("https", "signal.art", "/addstickers/", "pack_id=" + URLEncoder.encode(packId, StandardCharsets.UTF_8) + "&pack_key=" + URLEncoder.encode(Hex.toStringCondensed(packKey), StandardCharsets.UTF_8))
|
||||||
.toString();
|
.toString();
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
throw new AssertionError(e);
|
throw new AssertionError(e);
|
||||||
|
|
|
@ -27,11 +27,11 @@ import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -107,31 +107,16 @@ class Utils {
|
||||||
String[] params = query.split("&");
|
String[] params = query.split("&");
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
for (String param : params) {
|
for (String param : params) {
|
||||||
String name = null;
|
|
||||||
final String[] paramParts = param.split("=");
|
final String[] paramParts = param.split("=");
|
||||||
try {
|
String name = URLDecoder.decode(paramParts[0], StandardCharsets.UTF_8);
|
||||||
name = URLDecoder.decode(paramParts[0], "utf-8");
|
String value = URLDecoder.decode(paramParts[1], StandardCharsets.UTF_8);
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
// Impossible
|
|
||||||
}
|
|
||||||
String value = null;
|
|
||||||
try {
|
|
||||||
value = URLDecoder.decode(paramParts[1], "utf-8");
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
// Impossible
|
|
||||||
}
|
|
||||||
map.put(name, value);
|
map.put(name, value);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
static String createDeviceLinkUri(DeviceLinkInfo info) {
|
static String createDeviceLinkUri(DeviceLinkInfo info) {
|
||||||
try {
|
return "tsdevice:/?uuid=" + URLEncoder.encode(info.deviceIdentifier, StandardCharsets.UTF_8) + "&pub_key=" + URLEncoder.encode(Base64.encodeBytesWithoutPadding(info.deviceKey.serialize()), StandardCharsets.UTF_8);
|
||||||
return "tsdevice:/?uuid=" + URLEncoder.encode(info.deviceIdentifier, "utf-8") + "&pub_key=" + URLEncoder.encode(Base64.encodeBytesWithoutPadding(info.deviceKey.serialize()), "utf-8");
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
// Shouldn't happen
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static DeviceLinkInfo parseDeviceLinkUri(URI linkUri) throws IOException, InvalidKeyException {
|
static DeviceLinkInfo parseDeviceLinkUri(URI linkUri) throws IOException, InvalidKeyException {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue