escape network paths properly using python

This commit is contained in:
Kyle Sanderson 2023-08-27 19:45:14 -07:00
commit f7620cebc3

View file

@ -4,6 +4,8 @@ from __future__ import division, absolute_import, print_function, unicode_litera
##################################################################################################
from . import settings, LazyLogger
from urllib.parse import quote as urlquote
import re
##################################################################################################
@ -213,6 +215,11 @@ class API(object):
protocol = path.split('://')[0]
path = path.replace(protocol, protocol.lower())
if path.startswith('http') or path.startswith('ftp') or path.startswith('sftp'):
rs = re.search("(.*?://.+?/)(.+)", path)
if rs:
path = rs.group(1) + urlquote(rs.group(2))
return path
def get_user_artwork(self, user_id):