From a6b2b92513a1bc9907cb3c496b1784e487d60b8b Mon Sep 17 00:00:00 2001 From: Matthew Skinner Date: Thu, 13 Jul 2023 08:14:28 +1000 Subject: [PATCH] Log when cameras do not support BASIC support. (#15168) Signed-off-by: Matthew Skinner --- .../internal/action/TelegramActions.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.telegram/src/main/java/org/openhab/binding/telegram/internal/action/TelegramActions.java b/bundles/org.openhab.binding.telegram/src/main/java/org/openhab/binding/telegram/internal/action/TelegramActions.java index 2a372b5b7..4f3dedc4e 100644 --- a/bundles/org.openhab.binding.telegram/src/main/java/org/openhab/binding/telegram/internal/action/TelegramActions.java +++ b/bundles/org.openhab.binding.telegram/src/main/java/org/openhab/binding/telegram/internal/action/TelegramActions.java @@ -352,7 +352,13 @@ public class TelegramActions implements ThingActions { byte[] fileContent = contentResponse.getContent(); sendPhoto = new SendPhoto(chatId, fileContent); } else { - logger.warn("Download from {} failed with status: {}", photoURL, contentResponse.getStatus()); + if (contentResponse.getStatus() == 401 + && contentResponse.getHeaders().get(HttpHeader.WWW_AUTHENTICATE).contains("igest")) { + logger.warn("Download from {} failed due to no BASIC http auth support.", photoURL); + } else { + logger.warn("Download from {} failed with status: {}", photoURL, + contentResponse.getStatus()); + } sendTelegram(chatId, caption + ":Download failed with status " + contentResponse.getStatus()); return false; } @@ -555,7 +561,13 @@ public class TelegramActions implements ThingActions { byte[] fileContent = contentResponse.getContent(); sendVideo = new SendVideo(chatId, fileContent); } else { - logger.warn("Download from {} failed with status: {}", videoURL, contentResponse.getStatus()); + if (contentResponse.getStatus() == 401 + && contentResponse.getHeaders().get(HttpHeader.WWW_AUTHENTICATE).contains("igest")) { + logger.warn("Download from {} failed due to no BASIC http auth support.", videoURL); + } else { + logger.warn("Download from {} failed with status: {}", videoURL, + contentResponse.getStatus()); + } sendTelegram(chatId, caption + ":Download failed with status " + contentResponse.getStatus()); return false; }