Skip to content

Commit

Permalink
fix: add support for relative links
Browse files Browse the repository at this point in the history
 Changes to be committed:
	modified:   octoprint_telegram/__init__.py
  • Loading branch information
damned-me committed May 24, 2024
1 parent 5322eff commit 261ec9d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions octoprint_telegram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
) # dict of known notification messages
from .emojiDict import telegramEmojiDict # dict of known emojis
from babel.dates import format_date, format_datetime, format_time

import urllib.parse

bytes_reader_class = io.BytesIO

Expand Down Expand Up @@ -2563,7 +2563,8 @@ def getUpdateMsgId(self, id):
def take_image(self, snapshot_url=""):
if snapshot_url == "":
snapshot_url = self._settings.global_get(["webcam", "snapshot"])

if not urllib.parse.urlparse(snapshot_url).netloc:
snapshot_url = "http://localhost" + snapshot_url
self._logger.debug("Snapshot URL: " + str(snapshot_url))
data = None
if snapshot_url:
Expand Down Expand Up @@ -2753,7 +2754,7 @@ def create_gif_new(self, chatID, sec=7, multicam_prof=0):

if stream_url == 0:
stream_url = self._settings.global_get(["webcam", "stream"])
if "http" not in stream_url:
if not urllib.parse.urlparse(stream_url).netloc:
stream_url = "http://localhost" + stream_url

if sec == 0:
Expand Down

0 comments on commit 261ec9d

Please sign in to comment.