We have these two gems(and many others) to get the original url from the short url.I have used both of these two gems and its works fine.
But I was getting the error like this.”URI::InvalidURIError in FoosController#foo(action)” or “bad URI for the expurrel gem” or “bad URI for the longurl gem”, then I passed shorturl as an argument after use 'gsub' operation on the shorturl.
one shorturl like @str = “http://bit.ly/dtR48F” then try for the following code:
@short_url = @str.to_s.gsub("(","").gsub(")","")
if you use Expurrel gem then:
e = Expurrel.new(@short_url)
and if you use Longurl gem then:
e = LongURL::Expander.new
Such error was ocuuring because sometimes user enters the shorturl within “( )” brackets and gem can not expand such a URL so it gives “Bad URI” error.
I hope it would help anyone.