ruby / ruby/uri

Use URI::RFC2396_PARSER.escape explicitly.

Open
#235 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
125
Forks
65
Avg merge
6h 4m
Merged PRs (30d)
2

Description

warning: URI::RFC3986_PARSER.escape is obsolete. Use URI::RFC2396_PARSER.escape explicitly.

The code I was using was along those lines:

begin
    this_webpage = URI.parse(this_webpage)
  rescue URI::InvalidURIError
    this_webpage = URI.parse(URI::Parser.new.escape(this_webpage))
  end

Could you guys clean this up internally? In my own downstream code I never
use either of those two constants, but I do have warnings on, so I notice
this warning. I reckon this may simply be to change towards the other RFC,
but I don't know the URI internals well enough to suggest anything really.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the URI library for uses of URI::RFC3986_PARSER.escape and URI::Parser.new.escape, then start at the URI.parse fallback that rescues URI::InvalidURIError. The change is done when the obsolete warning no longer appears while escaping invalid input continues to work; verify with the URI parsing and escaping tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.