ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:90284] [CommonRuby Feature#15378] URI::InvalidURIError (bad URI(is not URI?)
       [not found] <redmine.issue-15378.20181204113455@ruby-lang.org>
@ 2018-12-04 11:34 ` ipatovanton
  2018-12-05  0:34 ` [ruby-core:90292] [CommonRuby Feature#15378][Feedback] " shyouhei
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: ipatovanton @ 2018-12-04 11:34 UTC (permalink / raw)
  To: ruby-core

Issue #15378 has been reported by ipatovanton (Anton Ipatov).

----------------------------------------
Feature #15378: URI::InvalidURIError (bad URI(is not URI?)
https://bugs.ruby-lang.org/issues/15378

* Author: ipatovanton (Anton Ipatov)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
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'



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:90292] [CommonRuby Feature#15378][Feedback] URI::InvalidURIError (bad URI(is not URI?)
       [not found] <redmine.issue-15378.20181204113455@ruby-lang.org>
  2018-12-04 11:34 ` [ruby-core:90284] [CommonRuby Feature#15378] URI::InvalidURIError (bad URI(is not URI?) ipatovanton
@ 2018-12-05  0:34 ` shyouhei
  2018-12-05 20:15 ` [ruby-core:90327] [CommonRuby Feature#15378] " ipatovanton
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: shyouhei @ 2018-12-05  0:34 UTC (permalink / raw)
  To: ruby-core

Issue #15378 has been updated by shyouhei (Shyouhei Urabe).

Status changed from Open to Feedback

Can I ask you the exact representation of the self.url parameter, not just its printable part? I guess it contains control character, most likely newlines.

just add `raise self.uri.inspect` right before the line you are getting the exception now, and tell us the verbatim output.

----------------------------------------
Feature #15378: URI::InvalidURIError (bad URI(is not URI?)
https://bugs.ruby-lang.org/issues/15378#change-75399

* Author: ipatovanton (Anton Ipatov)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
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'



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:90327] [CommonRuby Feature#15378] URI::InvalidURIError (bad URI(is not URI?)
       [not found] <redmine.issue-15378.20181204113455@ruby-lang.org>
  2018-12-04 11:34 ` [ruby-core:90284] [CommonRuby Feature#15378] URI::InvalidURIError (bad URI(is not URI?) ipatovanton
  2018-12-05  0:34 ` [ruby-core:90292] [CommonRuby Feature#15378][Feedback] " shyouhei
@ 2018-12-05 20:15 ` ipatovanton
  2018-12-06  0:42 ` [ruby-core:90331] [CommonRuby Feature#15378][Third Party's Issue] " shyouhei
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: ipatovanton @ 2018-12-05 20:15 UTC (permalink / raw)
  To: ruby-core

Issue #15378 has been updated by ipatovanton (Anton Ipatov).


~~~ ruby
RuntimeError ("\nhttp://zapovednik.space/material/stantsija-petropavlovsk"):
~~~


----------------------------------------
Feature #15378: URI::InvalidURIError (bad URI(is not URI?)
https://bugs.ruby-lang.org/issues/15378#change-75435

* Author: ipatovanton (Anton Ipatov)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
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'



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:90331] [CommonRuby Feature#15378][Third Party's Issue] URI::InvalidURIError (bad URI(is not URI?)
       [not found] <redmine.issue-15378.20181204113455@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2018-12-05 20:15 ` [ruby-core:90327] [CommonRuby Feature#15378] " ipatovanton
@ 2018-12-06  0:42 ` shyouhei
  2018-12-06  7:49 ` [ruby-core:90336] [CommonRuby Feature#15378] " ipatovanton
  2018-12-07  9:22 ` [ruby-core:90361] " shyouhei
  5 siblings, 0 replies; 6+ messages in thread
From: shyouhei @ 2018-12-06  0:42 UTC (permalink / raw)
  To: ruby-core

Issue #15378 has been updated by shyouhei (Shyouhei Urabe).

Description updated
Status changed from Feedback to Third Party's Issue

ipatovanton (Anton Ipatov) wrote:
> ~~~ ruby
> RuntimeError ("\nhttp://zapovednik.space/material/stantsija-petropavlovsk"):
> ~~~

Thank you!

The problem is the "\n" at the very beginning of `self.url`.  This is in fact a bad URI.
To fix this, please remove that before calling `URI()`.

----------------------------------------
Feature #15378: URI::InvalidURIError (bad URI(is not URI?)
https://bugs.ruby-lang.org/issues/15378#change-75442

* Author: ipatovanton (Anton Ipatov)
* Status: Third Party's Issue
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
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'
~~~



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:90336] [CommonRuby Feature#15378] URI::InvalidURIError (bad URI(is not URI?)
       [not found] <redmine.issue-15378.20181204113455@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2018-12-06  0:42 ` [ruby-core:90331] [CommonRuby Feature#15378][Third Party's Issue] " shyouhei
@ 2018-12-06  7:49 ` ipatovanton
  2018-12-07  9:22 ` [ruby-core:90361] " shyouhei
  5 siblings, 0 replies; 6+ messages in thread
From: ipatovanton @ 2018-12-06  7:49 UTC (permalink / raw)
  To: ruby-core

Issue #15378 has been updated by ipatovanton (Anton Ipatov).


Thank you!

What do you think is the problem with the encoding?


----------------------------------------
Feature #15378: URI::InvalidURIError (bad URI(is not URI?)
https://bugs.ruby-lang.org/issues/15378#change-75448

* Author: ipatovanton (Anton Ipatov)
* Status: Third Party's Issue
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
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'
~~~



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:90361] [CommonRuby Feature#15378] URI::InvalidURIError (bad URI(is not URI?)
       [not found] <redmine.issue-15378.20181204113455@ruby-lang.org>
                   ` (4 preceding siblings ...)
  2018-12-06  7:49 ` [ruby-core:90336] [CommonRuby Feature#15378] " ipatovanton
@ 2018-12-07  9:22 ` shyouhei
  5 siblings, 0 replies; 6+ messages in thread
From: shyouhei @ 2018-12-07  9:22 UTC (permalink / raw)
  To: ruby-core

Issue #15378 has been updated by shyouhei (Shyouhei Urabe).


ipatovanton (Anton Ipatov) wrote:
> Thank you!
> 
> What do you think is the problem with the encoding?

As far as I can see from the info you gave us, it seems the problem has nothing to do with encodings.

----------------------------------------
Feature #15378: URI::InvalidURIError (bad URI(is not URI?)
https://bugs.ruby-lang.org/issues/15378#change-75472

* Author: ipatovanton (Anton Ipatov)
* Status: Third Party's Issue
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
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'
~~~



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-12-07  9:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-15378.20181204113455@ruby-lang.org>
2018-12-04 11:34 ` [ruby-core:90284] [CommonRuby Feature#15378] URI::InvalidURIError (bad URI(is not URI?) ipatovanton
2018-12-05  0:34 ` [ruby-core:90292] [CommonRuby Feature#15378][Feedback] " shyouhei
2018-12-05 20:15 ` [ruby-core:90327] [CommonRuby Feature#15378] " ipatovanton
2018-12-06  0:42 ` [ruby-core:90331] [CommonRuby Feature#15378][Third Party's Issue] " shyouhei
2018-12-06  7:49 ` [ruby-core:90336] [CommonRuby Feature#15378] " ipatovanton
2018-12-07  9:22 ` [ruby-core:90361] " shyouhei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).