Created
February 17, 2010 03:05
-
-
Save no6v/306243 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/plugins/expand-tinyurl.rb b/lib/plugins/expand-tinyurl.rb | |
index 15368a8..4ab563d 100644 | |
--- a/lib/plugins/expand-tinyurl.rb | |
+++ b/lib/plugins/expand-tinyurl.rb | |
@@ -40,8 +40,9 @@ def expand_url(host, path) | |
h.get(path, { 'User-Agent' => 'Mozilla' }) | |
end | |
return nil unless res.code == "301" or res.code == "302" | |
- newurl = res['Location'] | |
- newurl.force_encoding(Encoding::UTF_8) if newurl.respond_to?(:force_encoding) | |
+ res['Location'].tap do |newurl| | |
+ newurl.force_encoding(Encoding::UTF_8) if newurl.respond_to?(:force_encoding) | |
+ end | |
rescue Exception => e | |
Termtter::Client.handle_error(e) | |
nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment