[#100309] How to use backport custom field — Jun Aruga <jaruga@...>
Please allow my ignorance.
9 messages
2020/10/06
[#100310] Re: How to use backport custom field
— "NARUSE, Yui" <naruse@...>
2020/10/06
IkJhY2twb3J0IGN1c3RvbSBmaWVsZCIgaXMgb25seSBhdmFpbGFibGUgZm9yIHRpY2tldHMgd2hv
[#100311] Re: How to use backport custom field
— Jun Aruga <jaruga@...>
2020/10/06
On Tue, Oct 6, 2020 at 4:44 PM NARUSE, Yui <[email protected]> wrote:
[#100314] Re: How to use backport custom field
— "NARUSE, Yui" <naruse@...>
2020/10/06
VGhhbmsgeW91IGZvciBjb25maXJtYXRpb24uCkkgY2hlY2tlZCBhZ2FpbiBhbmQgdG8gZWRpdCBi
[#100322] Re: How to use backport custom field
— Jun Aruga <jaruga@...>
2020/10/07
On Tue, Oct 6, 2020 at 7:25 PM NARUSE, Yui <[email protected]> wrote:
[#100326] Re: How to use backport custom field
— "NARUSE, Yui" <naruse@...>
2020/10/07
SSBhZGRlZCB5b3UgdG8gIlJlcG9ydGVyIiByb2xlIGluIHRoZSBwcm9qZWN0CgoyMDIw5bm0MTDm
[#100327] Re: How to use backport custom field
— Jun Aruga <jaruga@...>
2020/10/07
On Wed, Oct 7, 2020 at 1:42 PM NARUSE, Yui <[email protected]> wrote:
[ruby-core:100672] [Ruby master Bug#17293] URI.parse fails to parse correctly URN or other special characters in path/url
From:
merch-redmine@...
Date:
2020-10-30 15:32:09 UTC
List:
ruby-core #100672
Issue #17293 has been updated by jeremyevans0 (Jeremy Evans).
Status changed from Open to Rejected
greg.howdeshell (Greg Howdeshell) wrote:
> URI.parse looks to fail parsing endpoints that have special characters. For example:
>
> ``` ruby
> url = 'http://foobar.com/#/applications/'
> path = 'my_application'
> URI.join(url, path).to_s
> ```
> The result renders `http://foobar.com/my_application`.
This is expected. The `#/applications/` is an anchor/fragment, not part of the path (path is `/`). For `my_application`, that is interpreted as the path, so it overwrites the path of the `url`. You get the same result for `URI.join('http://foobar.com/', 'my_application').to_s`.
>
> Or in the case of executing an API marked by URNs so the ID field in my GET request is something like
>
> ```ruby
> key = 'urn:api:baz:1'
> url = 'http://foobar.com/api'
> URI.join(url, key).to_s
> ```
> The result renders `urn:api:baz:1`.
The issue here is that `'urn:api:baz:1'` is interpreted as a URI with scheme `urn` and opaque part `api:baz:1`, which overrides the entire url.
The `URI.join` documents the behavior: `String(s) to work with, will be converted to RFC3986 URIs before merging.`.
You probably don't want to use `URI.join` in either example. You may want something like the following, but I'm not even sure of what URIs you are trying to generate:
```ruby
url = 'http://foobar.com/#/applications/'
path = 'my_application'
uri = URI.parse(url)
uri.fragment += path
uri.to_s
# => "http://foobar.com/#/applications/my_application"
key = 'urn:api:baz:1'
url = 'http://foobar.com/api'
uri = URI.parse(url)
uri.query = "ID=#{key}"
uri.to_s
# => "http://foobar.com/api?ID=urn:api:baz:1"
```
----------------------------------------
Bug #17293: URI.parse fails to parse correctly URN or other special characters in path/url
https://bugs.ruby-lang.org/issues/17293#change-88308
* Author: greg.howdeshell (Greg Howdeshell)
* Status: Rejected
* Priority: Normal
* ruby -v: 2.6.x
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
URI.parse looks to fail parsing endpoints that have special characters. For example:
``` ruby
url = 'http://foobar.com/#/applications/'
path = 'my_application'
URI.join(url, path).to_s
```
The result renders `http://foobar.com/my_application`.
Or in the case of executing an API marked by URNs so the ID field in my GET request is something like
```ruby
key = 'urn:api:baz:1'
url = 'http://foobar.com/api'
URI.join(url, key).to_s
```
The result renders `urn:api:baz:1`.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>