From fd01b2723048ee8bf975cfe4833b3b88fb863358 Mon Sep 17 00:00:00 2001 From: valiant1x Date: Mon, 30 Nov 2020 08:54:46 -0600 Subject: [PATCH] fix unreserved character compliance --- src/rfc3986/abnf_regexp.py | 2 +- tests/test_normalizers.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rfc3986/abnf_regexp.py b/src/rfc3986/abnf_regexp.py index 5852e4d..ba062b3 100644 --- a/src/rfc3986/abnf_regexp.py +++ b/src/rfc3986/abnf_regexp.py @@ -27,7 +27,7 @@ ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" DIGIT = "0123456789" # https://tools.ietf.org/html/rfc3986#section-2.3 -UNRESERVED = UNRESERVED_CHARS = ALPHA + DIGIT + r"._!-" +UNRESERVED = UNRESERVED_CHARS = ALPHA + DIGIT + r'._!-~' UNRESERVED_CHARS_SET = set(UNRESERVED_CHARS) NON_PCT_ENCODED_SET = RESERVED_CHARS_SET.union(UNRESERVED_CHARS_SET) # We need to escape the '-' in this case: diff --git a/tests/test_normalizers.py b/tests/test_normalizers.py index 1dbd6fa..eff650c 100644 --- a/tests/test_normalizers.py +++ b/tests/test_normalizers.py @@ -97,6 +97,7 @@ def test_fragment_normalization(): ["component", "encoded_component"], [ ("/%", "/%25"), + ("/~", "/~"), ("/%a", "/%25a"), ("/%ag", "/%25ag"), ("/%af", "/%af"),