psf / psf/requests

Treat invalid percent encoding consistently

Open
#5,461 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
54.3k
Forks
10.4k
Avg merge
16h 43m
Merged PRs (30d)
3

Description

The present form of requote_uri unnecessarily divides invalid cases.

When alpha-numeric, '%' is quoted to '%25'.
E.g. %pp to %25pp.

When not alpha-numeric, '%' is kept as is.
E.g. %-- to %--.
(Note these two examples are in the tests,
and the latter is for unquote_unreserved,
but the result is the same.)
Or %<< to %%3C%3C.

but I think '%' should be quoted in all invalid cases.
(Or to put it differently, isolated '%' must be quoted.)

Contributor guide

Open the contributing guide

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

Start by reading requote_uri and the existing tests for invalid percent encodings, including the examples in the issue. Trace how alpha-numeric and non-alphanumeric invalid cases are handled, then verify that isolated percent signs are treated consistently and the relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.