Skip to content

Commit

Permalink
fix: join_url improperly encodes URL
Browse files Browse the repository at this point in the history
  • Loading branch information
akalex committed Mar 19, 2024
1 parent 4527f06 commit e2a9040
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Changelog
## 3.6.3
* [FIX] The ``join_url`` util has been tuned to encode the URL properly when the path is present. That led to the invalid URL being built.

## 3.6.2
* Resolve a couple of security concerns by updating `cryptography` package to `42.0.4`.
* [High] cryptography NULL pointer dereference with pkcs12.serialize_key_and_certificates when called with a non-matching certificate and private key and an hmac_hash override
Expand Down
2 changes: 1 addition & 1 deletion async_firebase/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def join_url(
"""
url = base
if parts:
quoted_and_stripped_parts = [quote(str(part).strip("/"), safe=":") for part in 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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "async-firebase"
version = "3.6.2"
version = "3.6.3"
description = "Async Firebase Client - a Python asyncio client to interact with Firebase Cloud Messaging in an easy way."
license = "MIT"
authors = [
Expand Down
8 changes: 8 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,14 @@ def test_cleanup_firebase_message(firebase_message, exp_result):
False,
"http://base/message:send",
),
(
"https://fcm.googleapis.com",
["/v1/projects/my-project", "messages:send"],
None,
False,
False,
"https://fcm.googleapis.com/v1/projects/my-project/messages:send",
),
),
)
def test_join_url_common_flows(base, parts, params, leading_slash, trailing_slash, exp_result):
Expand Down

0 comments on commit e2a9040

Please sign in to comment.