]> git.basschouten.com Git - openhab-addons.git/commitdiff
Log when cameras do not support BASIC support. (#15168)
authorMatthew Skinner <matt@pcmus.com>
Wed, 12 Jul 2023 22:14:28 +0000 (08:14 +1000)
committerGitHub <noreply@github.com>
Wed, 12 Jul 2023 22:14:28 +0000 (00:14 +0200)
Signed-off-by: Matthew Skinner <matt@pcmus.com>
bundles/org.openhab.binding.telegram/src/main/java/org/openhab/binding/telegram/internal/action/TelegramActions.java

index 2a372b5b7f0e3f0f55636385641d6c67046c1907..4f3dedc4e256c6dae18f641c71f1b1de724b1eea 100644 (file)
@@ -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;
                     }