Я отправляю файл pdf через пользовательское приложение telegramBot клиенту в telegram. Клиент получает .txt (тип по умолчанию)
// file = "application/pdf;base64,JVBERi0xLjMN...DAwMT=="
private String sendFileToClient(String clientExtId, String file) {
String fileLink;
byte[] data = DatatypeConverter.parseBase64Binary(file);
SendDocument sendDocument = new SendDocument(clientExtId, data);
try {
SendResponse execute = telegramBot.execute(sendDocument);
Document document = execute.message().document();
final String documentId = document.fileId();
fileLink = getFileLink(documentId);
return fileLink;
} catch (Exception e) {
....
}
}
public String getFileLink(String fileId) {
GetFile getFile = new GetFile(fileId);
GetFileResponse fileResponse = telegramBot.execute(getFile);
File file = fileResponse.file();
log.info("getRelativeFilePath filePath : {}", file.filePath()); // documents/file_203.txt ????
return telegramBot.getFullFilePath(file);
}
Почему мой файл возвращает .txt, а не pdf?
, когда я отправляю фото, возвращаю - photos / file_202.jpg
Какая проблема? Пожалуйста, помогите)
UP: compile ('com.github.pengrad: java -telegram-bot-api: XXX')