diff --git a/homeassistant/components/discord/notify.py b/homeassistant/components/discord/notify.py index 2e13b68225c..7c4b10f5662 100644 --- a/homeassistant/components/discord/notify.py +++ b/homeassistant/components/discord/notify.py @@ -49,8 +49,12 @@ class DiscordNotificationService(BaseNotificationService): def file_exists(self, filename): """Check if a file exists on disk and is in authorized path.""" if not self.hass.config.is_allowed_path(filename): + _LOGGER.warning("Path not allowed: %s", filename) return False - return os.path.isfile(filename) + if not os.path.isfile(filename): + _LOGGER.warning("Not a file: %s", filename) + return False + return True async def async_send_message(self, message, **kwargs): """Login to Discord, send message to channel(s) and log out.""" @@ -98,8 +102,6 @@ class DiscordNotificationService(BaseNotificationService): if image_exists: images.append(image) - else: - _LOGGER.warning("Image not found: %s", image) await discord_bot.login(self.token)