lstrip text html check

This commit is contained in:
Gordon Shumway 2019-05-04 18:44:15 -04:00 committed by GitHub
parent 30d1aeb5a1
commit 2e7c3399e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -594,7 +594,7 @@ class ASCII(callbacks.Plugin):
if url.startswith("https://paste.ee/p/"): if url.startswith("https://paste.ee/p/"):
url = re.sub("https://paste.ee/p/", "https://paste.ee/r/", url) url = re.sub("https://paste.ee/p/", "https://paste.ee/r/", url)
file = requests.get(url) file = requests.get(url)
if "<!DOCTYPE html>" in file.text.splitlines()[:10]: if "<!DOCTYPE html>" in file.text.lstrip().splitlines()[:10]:
irc.reply("Error: ansi2irc requires a text file as input.", private=False, notice=False) irc.reply("Error: ansi2irc requires a text file as input.", private=False, notice=False)
return return
elif url.endswith(".txt") or url.startswith("https://pastebin.com/raw/") or url.startswith("https://paste.ee/r/"): elif url.endswith(".txt") or url.startswith("https://pastebin.com/raw/") or url.startswith("https://paste.ee/r/"):
@ -636,7 +636,7 @@ class ASCII(callbacks.Plugin):
delay = self.registryValue('delay', msg.args[0]) delay = self.registryValue('delay', msg.args[0])
try: try:
file = requests.get(url) file = requests.get(url)
if "<!DOCTYPE html>" in file.text.splitlines()[:10]: if "<!DOCTYPE html>" in file.text.lstrip().splitlines()[:10]:
irc.reply("Error: ansi2irc requires a text file as input.", private=False, notice=False) irc.reply("Error: ansi2irc requires a text file as input.", private=False, notice=False)
return return
try: try: