diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-02-13 01:53:39 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-02-13 01:53:39 +0100 |
commit | 4a02f91e3e8aa783799b1b82a591206fad9840b6 (patch) | |
tree | 73366d42d56758ed4f8a15794af0bd800e7ad6df /data/rbot | |
parent | 5b653affaa2028e8a743965d5d7d303ae7a6c310 (diff) |
url plugin: strip final characters from URL when we get 404, in case it was due to trailing punctuation
Diffstat (limited to 'data/rbot')
-rw-r--r-- | data/rbot/plugins/url.rb | 5 |
1 files changed, 5 insertions, 0 deletions
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 |