summaryrefslogtreecommitdiff
path: root/data/rbot/plugins/url.rb
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-02-13 01:53:39 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-02-13 01:53:39 +0100
commit4a02f91e3e8aa783799b1b82a591206fad9840b6 (patch)
tree73366d42d56758ed4f8a15794af0bd800e7ad6df /data/rbot/plugins/url.rb
parent5b653affaa2028e8a743965d5d7d303ae7a6c310 (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/plugins/url.rb')
-rw-r--r--data/rbot/plugins/url.rb5
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