diff options
-rw-r--r-- | debian/patches/0010-fix-json-uri-subtype.patch | 63 | ||||
-rw-r--r-- | debian/patches/series | 1 |
2 files changed, 0 insertions, 64 deletions
diff --git a/debian/patches/0010-fix-json-uri-subtype.patch b/debian/patches/0010-fix-json-uri-subtype.patch deleted file mode 100644 index 630306bd..00000000 --- a/debian/patches/0010-fix-json-uri-subtype.patch +++ /dev/null @@ -1,63 +0,0 @@ -Description: uri: fix search for json types to include strings in the format xxx/yyy+json -Author: Brent Barbachem <barbacbd@dukes.jmu.edu> -Origin: upstream, https://github.com/ansible/ansible/pull/80870 -Bug: https://github.com/ansible/ansible/issues/80709 -Forwarded: not-needed -Applied-Upstream: https://github.com/ansible/ansible/pull/80745 -Reviewed-by: Lee Garrett <debian@rocketjump.eu> -Last-Update: 2023-06-16 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -diff --git a/changelogs/fragments/update-maybe-json-uri.yml b/changelogs/fragments/update-maybe-json-uri.yml -new file mode 100644 -index 00000000000000..7cf693d2ce279b ---- /dev/null -+++ b/changelogs/fragments/update-maybe-json-uri.yml -@@ -0,0 +1,2 @@ -+bugfixes: -+- uri - fix search for JSON type to include complex strings containing '+' -diff --git a/lib/ansible/modules/uri.py b/lib/ansible/modules/uri.py -index 7919b9b2f5a0f3..9f01e1f73e0dd3 100644 ---- a/lib/ansible/modules/uri.py -+++ b/lib/ansible/modules/uri.py -@@ -706,7 +706,15 @@ def main(): - sub_type = 'octet-stream' - content_encoding = 'utf-8' - -- maybe_json = content_type and sub_type.lower() in JSON_CANDIDATES -+ if sub_type and '+' in sub_type: -+ # https://www.rfc-editor.org/rfc/rfc6839#section-3.1 -+ sub_type_suffix = sub_type.partition('+')[2] -+ maybe_json = content_type and sub_type_suffix.lower() in JSON_CANDIDATES -+ elif sub_type: -+ maybe_json = content_type and sub_type.lower() in JSON_CANDIDATES -+ else: -+ maybe_json = False -+ - maybe_output = maybe_json or return_content or info['status'] not in status_code - - if maybe_output: -diff --git a/test/integration/targets/uri/tasks/main.yml b/test/integration/targets/uri/tasks/main.yml -index 7fa687b4e7ea2a..9ba09ece7a0313 100644 ---- a/test/integration/targets/uri/tasks/main.yml -+++ b/test/integration/targets/uri/tasks/main.yml -@@ -687,6 +687,18 @@ - that: - - result.json.json[0] == 'JSON Test Pattern pass1' - -+- name: Test find JSON as subtype -+ uri: -+ url: "https://{{ httpbin_host }}/response-headers?content-type=application/ld%2Bjson" -+ method: POST -+ return_content: true -+ register: result -+ -+- name: Validate JSON as subtype -+ assert: -+ that: -+ - result.json is defined -+ - - name: Make request that includes password in JSON keys - uri: - url: "https://{{ httpbin_host}}/get?key-password=value-password" - diff --git a/debian/patches/series b/debian/patches/series index 20d747e2..9eedd1c6 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,2 @@ 0005-use-py3.patch 0009-resolvelib_compat.patch -0010-fix-json-uri-subtype.patch |