Skip to content

Commit

Permalink
[mediadownloader] encode url if need
Browse files Browse the repository at this point in the history
Traceback (most recent call last):
File "/usr/lib/enigma2/python/StartEnigma.py", line 217, in processDelay
callback(*retval)
File
"/usr/lib/enigma2/python/Plugins/Extensions/MediaDownloader/MediaDownloader.py",
line 191, in gotFilename
self.fetchFile()
File
"/usr/lib/enigma2/python/Plugins/Extensions/MediaDownloader/MediaDownloader.py",
line 198, in fetchFile
d = download(
File
"/usr/lib/enigma2/python/Plugins/Extensions/MediaDownloader/MediaDownloader.py",
line 116, in download
factory = HTTPProgressDownloader(url, file, writeProgress, *args,
**kwargs)
File
"/usr/lib/enigma2/python/Plugins/Extensions/MediaDownloader/HTTPProgressDownloader.py",
line 8, in init
HTTPDownloader.init(self, url, fileOrName, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/twisted/web/client.py", line 515,
in init
File "/usr/lib/python3.9/site-packages/twisted/web/client.py", line 375,
in init
File "/usr/lib/python3.9/site-packages/twisted/web/client.py", line 398,
in setURL
File "/usr/lib/python3.9/site-packages/twisted/web/_newclient.py", line
634, in _ensureValidURI
TypeError: cannot use a bytes pattern on a string-like object
  • Loading branch information
Dima73 authored and littlesat committed Oct 8, 2024
1 parent af0138d commit 054301c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mediadownloader/src/HTTPProgressDownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def __init__(self, url, fileOrName, writeProgress=None, *args, **kwargs):
HTTPDownloader.__init__(self, url, fileOrName, *args, **kwargs)

# Save callback(s) locally
if writeProgress and type(writeProgress) is not list:
if writeProgress and not isinstance(writeProgress, list):
writeProgress = [writeProgress]
self.writeProgress = writeProgress

Expand Down
3 changes: 3 additions & 0 deletions mediadownloader/src/MediaDownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ def download(url, file, writeProgress=None, contextFactory=None,
else:
kwargs["headers"] = AuthHeaders

if isinstance(url, str):
url = url.encode("utf-8")

from .HTTPProgressDownloader import HTTPProgressDownloader
from twisted.internet import reactor

Expand Down

0 comments on commit 054301c

Please sign in to comment.