if (username != null && password != null) {
AuthenticationStore auth = client.getAuthenticationStore();
URI uri = URI.create(photoURL);
- auth.addAuthenticationResult(new BasicResult(HttpHeader.AUTHORIZATION, uri,
- "Basic " + Base64.getEncoder().encodeToString(
- (username + ":" + password).getBytes(StandardCharsets.ISO_8859_1))));
+ auth.addAuthenticationResult(
+ new BasicResult(HttpHeader.AUTHORIZATION, uri, "Basic " + Base64.getEncoder()
+ .encodeToString((username + ":" + password).getBytes(StandardCharsets.UTF_8))));
}
try {
// API has 10mb limit to jpg file size, without this it can only accept 2mb
sendPhoto = new SendPhoto(chatId, fileContent);
} else {
logger.warn("Download from {} failed with status: {}", photoURL, contentResponse.getStatus());
+ sendTelegram(chatId, caption + ":Download failed with status " + contentResponse.getStatus());
return false;
}
} catch (InterruptedException | ExecutionException e) {
} else {
logger.warn("Download from {} failed with status: {}", animationURL,
contentResponse.getStatus());
+ sendTelegram(chatId, caption + ":Download failed with status " + contentResponse.getStatus());
return false;
}
} catch (InterruptedException | ExecutionException e) {
sendVideo = new SendVideo(chatId, fileContent);
} else {
logger.warn("Download from {} failed with status: {}", videoURL, contentResponse.getStatus());
+ sendTelegram(chatId, caption + ":Download failed with status " + contentResponse.getStatus());
return false;
}
} catch (InterruptedException | ExecutionException e) {