Check to see if matched domain exists in dictionary.

Check to see if matched domain exists in dictionary before attempting to access
it.
This commit is contained in:
Peter Ajamian 2020-09-09 17:21:38 +12:00
parent df22176150
commit c2c58d5fa2
2 changed files with 3 additions and 1 deletions

View File

@ -38,7 +38,7 @@ from supybot import world
# Use this for the version of this plugin. You may wish to put a CVS keyword
# in here if you're keeping the plugin in CVS or some similar system.
__version__ = "0.3"
__version__ = "0.4"
# XXX Replace this with an appropriate author or supybot.Author instance.
__author__ = supybot.Author('Peter Ajamian', 'pj', 'peter@pajamian.dhs.org')

View File

@ -78,6 +78,8 @@ class Pastebin2cpaste(callbacks.Plugin):
else:
text = msg.args[1]
for url in utils.web.httpUrlRe.findall(text):
if ! utils.web.getDomain(url).lower() in self.pastebins:
continue
pastebin = self.pastebins[utils.web.getDomain(url).lower()]
if pastebin:
pbCode = pastebin['regex'].search(url).group(1)