mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2025-01-03 18:38:26 +01:00
Reuse encoder for debugs
This commit is contained in:
parent
5ffc40b96f
commit
7fc39b1d53
@ -86,7 +86,7 @@ public class DebugCommand extends CombinedCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final String URL_FORMAT = DiscordSRV.WEBSITE + "/debug/%s#%s";
|
private static final String URL_FORMAT = DiscordSRV.WEBSITE + "/debug/%s#%s";
|
||||||
private static final Base64.Encoder KEY_ENCODER = Base64.getUrlEncoder().withoutPadding();
|
public static final Base64.Encoder KEY_ENCODER = Base64.getUrlEncoder().withoutPadding();
|
||||||
|
|
||||||
private final PasteService pasteService;
|
private final PasteService pasteService;
|
||||||
|
|
||||||
|
@ -53,6 +53,8 @@ import java.util.stream.Collectors;
|
|||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
|
import static com.discordsrv.common.command.combined.commands.DebugCommand.KEY_ENCODER;
|
||||||
|
|
||||||
public class DebugReport {
|
public class DebugReport {
|
||||||
|
|
||||||
private static final int BIG_FILE_SPLIT_SIZE = 50000;
|
private static final int BIG_FILE_SPLIT_SIZE = 50000;
|
||||||
@ -101,7 +103,7 @@ public class DebugReport {
|
|||||||
try {
|
try {
|
||||||
Paste paste = service.uploadFile(convertToJson(file).toString().getBytes(StandardCharsets.UTF_8));
|
Paste paste = service.uploadFile(convertToJson(file).toString().getBytes(StandardCharsets.UTF_8));
|
||||||
node.put("url", paste.url());
|
node.put("url", paste.url());
|
||||||
node.put("decryption_key", new String(Base64.getUrlEncoder().encode(paste.decryptionKey()), StandardCharsets.UTF_8));
|
node.put("decryption_key", new String(KEY_ENCODER.encode(paste.decryptionKey()), StandardCharsets.UTF_8));
|
||||||
node.put("length", length);
|
node.put("length", length);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
node.put("content", "Failed to upload file\n\n" + ExceptionUtils.getStackTrace(e));
|
node.put("content", "Failed to upload file\n\n" + ExceptionUtils.getStackTrace(e));
|
||||||
|
Loading…
Reference in New Issue
Block a user