From 4a02f91e3e8aa783799b1b82a591206fad9840b6 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Wed, 13 Feb 2008 01:53:39 +0100 Subject: url plugin: strip final characters from URL when we get 404, in case it was due to trailing punctuation --- data/rbot/plugins/url.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'data/rbot') diff --git a/data/rbot/plugins/url.rb b/data/rbot/plugins/url.rb index f44da3eb..ef5374ab 100644 --- a/data/rbot/plugins/url.rb +++ b/data/rbot/plugins/url.rb @@ -140,6 +140,11 @@ class UrlPlugin < Plugin debug "Title #{title ? '' : 'not '} found" reply = "#{LINK_INFO} #{title}" if title rescue => e + if e.message =~ /\(404 - Not Found\)/i + # see if we failed to find the thing because of trailing punctuation + # but check that we still have 'something' in the URL + retry if urlstr.chop! and urlstr =~ /^https?:\/\/./ + end reply = "Error #{e.message}" end -- cgit v1.2.3