Project

General

Profile

Feature #15378

Updated by shyouhei (Shyouhei Urabe) over 5 years ago

I using the ruby 2.5.3 and try to save this url http://zapovednik.space/material/stantsija-petropavlovsk 

 URI::InvalidURIError (bad URI(is not URI?):  
 http://zapovednik.space/material/stantsija-petropavlovsk): 

 ~~~ ruby 
 class FeedEntry 
   field :url, type: String 

   before_create :save_uri 

   def save_uri 
     self.url = URI(self.url).tap { |uri| uri.query = nil }.to_s 
   end 
 end 
 ~~~ 

 Trace: 

 ~~~ 
 /Users/ipatov/.rbenv/versions/2.5.3/lib/ruby/2.5.0/uri/rfc3986_parser.rb:67:in `split' 
 /Users/ipatov/.rbenv/versions/2.5.3/lib/ruby/2.5.0/uri/rfc3986_parser.rb:73:in `parse' 
 /Users/ipatov/.rbenv/versions/2.5.3/lib/ruby/2.5.0/uri/common.rb:237:in `parse' 
 /Users/ipatov/.rbenv/versions/2.5.3/lib/ruby/2.5.0/uri/common.rb:743:in `URI' 
 app/models/feed_entry.rb:54:in `save_uri' 
 activesupport (5.2.1.1) lib/active_support/callbacks.rb:426:in `block in make_lambda' 
 activesupport (5.2.1.1) lib/active_support/callbacks.rb:198:in `block (2 levels) in halting' 
 activesupport (5.2.1.1) lib/active_support/callbacks.rb:606:in `block (2 levels) in default_terminator' 
 activesupport (5.2.1.1) lib/active_support/callbacks.rb:605:in `catch' 
 activesupport (5.2.1.1) lib/active_support/callbacks.rb:605:in `block in default_terminator' 
 activesupport (5.2.1.1) lib/active_support/callbacks.rb:199:in `block in halting' 
 activesupport (5.2.1.1) lib/active_support/callbacks.rb:513:in `block in invoke_before' 
 activesupport (5.2.1.1) lib/active_support/callbacks.rb:513:in `each' 
 activesupport (5.2.1.1) lib/active_support/callbacks.rb:513:in `invoke_before' 
 activesupport (5.2.1.1) lib/active_support/callbacks.rb:131:in `run_callbacks' 
 ~~~

Back