YCC module: escape URL with unknown characters
This commit is contained in:
parent
50857eea80
commit
1c515f95c5
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
from urllib.parse import quote
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
|
|
||||||
nemubotversion = 3.3
|
nemubotversion = 3.3
|
||||||
@ -41,8 +42,9 @@ def cmd_ycc(msg):
|
|||||||
for url in msg.cmds[1:]:
|
for url in msg.cmds[1:]:
|
||||||
o = urlparse(url, "http")
|
o = urlparse(url, "http")
|
||||||
if o.scheme != "":
|
if o.scheme != "":
|
||||||
raw = urlopen("http://ycc.fr/redirection/create/" + url,
|
snd_url = "http://ycc.fr/redirection/create/" + quote(url, "/:%#@&=?")
|
||||||
timeout=10)
|
print_debug(snd_url)
|
||||||
|
raw = urlopen(snd_url, timeout=10)
|
||||||
if o.netloc == "":
|
if o.netloc == "":
|
||||||
res.append(gen_response(raw.read().decode(), msg, o.scheme))
|
res.append(gen_response(raw.read().decode(), msg, o.scheme))
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user