diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-08-23 07:27:32 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-08-23 07:27:32 +0000 |
commit | 2905d1791ccbe3a00669971d7d5e690643827751 (patch) | |
tree | a01bfdd018259b738c5ecf01e6d8e2459f5049aa /data/rbot/plugins/url.rb | |
parent | 9b64ef8fef8db1b55b1316bdfaa111b16680e351 (diff) |
url plugin: escape stuff before extracting urls
Diffstat (limited to 'data/rbot/plugins/url.rb')
-rw-r--r-- | data/rbot/plugins/url.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/data/rbot/plugins/url.rb b/data/rbot/plugins/url.rb index 373d5a87..77793b93 100644 --- a/data/rbot/plugins/url.rb +++ b/data/rbot/plugins/url.rb @@ -6,6 +6,7 @@ end class UrlPlugin < Plugin TITLE_RE = /<\s*?title\s*?>(.+?)<\s*?\/title\s*?>/im LINK_INFO = "[Link Info]" + OUR_UNSAFE = Regexp.new("[^#{URI::PATTERN::UNRESERVED}#{URI::PATTERN::RESERVED}%# ]", false, 'N') BotConfig.register BotConfigIntegerValue.new('url.max_urls', :default => 100, :validate => Proc.new{|v| v > 0}, @@ -131,7 +132,9 @@ class UrlPlugin < Plugin def listen(m) return unless m.kind_of?(PrivMessage) return if m.address? - urls = URI.extract(m.message) + + escaped = URI.escape(m.message, OUR_UNSAFE) + urls = URI.extract(escaped) return if urls.empty? debug "found urls #{urls.inspect}" list = @registry[m.target] |