From 888621da742ff9d93b6331c96b4bd86dd677944c Mon Sep 17 00:00:00 2001 From: Dmytro Nykonenko <10899530+ndmytro@users.noreply.github.com> Date: Fri, 16 Feb 2024 13:43:57 +0100 Subject: [PATCH] fix: [ISSUE-73] Do not quote the colon char in URLs --- CHANGES.md | 3 +++ async_firebase/utils.py | 3 ++- pyproject.toml | 2 +- tests/test_utils.py | 8 ++++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 2b44cba..fd23741 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,7 @@ # Changelog +## 3.6.1 +* Remove unintended quoting of the column char in the API URLs + ## 3.6.0 * Introduce send_each and send_each_for_multicast methods * Add deprecation warnings to send_all and send_multicast methods, because they use the API that diff --git a/async_firebase/utils.py b/async_firebase/utils.py index 71dba69..18d916c 100644 --- a/async_firebase/utils.py +++ b/async_firebase/utils.py @@ -46,7 +46,8 @@ def join_url( """ url = base if parts: - url = "/".join([base.strip("/"), quote("/".join(map(lambda x: str(x).strip("/"), parts)))]) + quoted_and_stripped_parts = [quote(str(part).strip("/"), safe=":") for part in parts] + url = "/".join([base.strip("/"), *quoted_and_stripped_parts]) # trailing slash can be important if trailing_slash: diff --git a/pyproject.toml b/pyproject.toml index 617db4e..48f5b1f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "async-firebase" -version = "3.6.0" +version = "3.6.1" description = "Async Firebase Client - a Python asyncio client to interact with Firebase Cloud Messaging in an easy way." license = "MIT" authors = [ diff --git a/tests/test_utils.py b/tests/test_utils.py index ffcc0e9..bbd111d 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -266,6 +266,14 @@ def test_cleanup_firebase_message(firebase_message, exp_result): False, "/base_path/path_1?q=test", ), + ( + "http://base", + ["message:send"], + None, + False, + False, + "http://base/message:send", + ), ), ) def test_join_url_common_flows(base, parts, params, leading_slash, trailing_slash, exp_result):