lib/postrank-uri.rb in postrank-uri-1.0.5 vs lib/postrank-uri.rb in postrank-uri-1.0.6

- old
+ new

@@ -130,17 +130,33 @@ u end def c18n(uri) u = parse(uri) + u = embedded(u) if q = u.query_values(:notation => :flat_array) q.delete_if { |k,v| C18N[:global].include?(k) } q.delete_if { |k,v| C18N[:hosts].find {|r,p| u.host =~ r && p.include?(k) } } end - u.query_values = q + + if u.host == 'twitter.com' && u.fragment.match(/^!(.*)/) + u.fragment = nil + u.path = $1 + end + u + end + + def embedded(uri) + if uri.host == 'news.google.com' && uri.path == '/news/url' \ + || uri.host == 'xfruits.com' + + embedded = uri.query_values['url'] + uri = clean(embedded, false) if embedded + end + uri end def parse(uri) return uri if uri.is_a? Addressable::URI \ No newline at end of file