Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use URI::RFC2396_Parser#regex explicitly. #138

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

hsbt
Copy link
Contributor

@hsbt hsbt commented Jul 19, 2024

I got the following error with the current develop version of ruby/ruby.

  87) Mustermann::Template level 4 operator + pattern "/{a}/{+b}" is expected to expand {:a=>"foo/bar", :b=>"foo/bar"}
      Failure/Error: it { should expand(a: 'foo/bar', b: 'foo/bar').to('/foo%2Fbar/foo/bar') }

      TypeError:
        no implicit conversion of nil into String
      # ./mustermann/lib/mustermann/ast/translator.rb:122:in 'Regexp.union'

In background, URI will change DEFAULT_PARSER to RFC3986_Parser.

ruby/uri#107

After that, we lost some of regex pattern like UNSAFE.

In background, URI will change DEFAULT_PARSER to RFC2396_Parser.

ruby/uri#107

After that, we lost some of regex pattern like UNSAFE.
Copy link
Member

@dentarg dentarg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

root@a48d10429c21:/# ruby -v
ruby 2.6.10p210 (2022-04-12 revision 67958) [aarch64-linux]
root@a48d10429c21:/#
root@a48d10429c21:/# ruby -e 'p URI::RFC2396_Parser.new.regexp[:UNSAFE]'
/[^\-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]]/

@dentarg dentarg merged commit 0b8554b into sinatra:main Jul 30, 2024
10 checks passed
@dentarg
Copy link
Member

dentarg commented Jul 30, 2024

Looks like there is a constant URI::RFC2396_PARSER that could be used in Ruby 3.4+ https://github.com/octokit/octokit.rb/pull/1708/files

@hsbt hsbt deleted the fix-uri-default-parser-change branch July 30, 2024 21:41
@dentarg
Copy link
Member

dentarg commented Jul 31, 2024

Released in v3.0.1

@hsbt
Copy link
Contributor Author

hsbt commented Jul 31, 2024

@dentarg Thanks!

dentarg pushed a commit that referenced this pull request Aug 9, 2024
`URI::DEFAULT_PARSER.escape` is obsoleted at next stable release of URI. We should use `URI::RFC2396_PARSER.escape` instead of `URI::DEFAULT_PARSER`.

Follow-up to #138
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants