Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncate large values inside of Firebase notification body fields. #386

Merged
merged 14 commits into from
Jun 26, 2024

Conversation

devonh
Copy link
Contributor

@devonh devonh commented Jun 20, 2024

This PR changes the use of the Firebase v1 API to truncate the content fields within data to a maximum length.

NOTE: The existing code for the legacy API does not effectively truncate content since it relies on len(data[attr]) > MAX_BYTES_PER_FIELD which will return the number of keys inside the content dict. Since the legacy API is being removed tomorrow, I don't want to spend time coming up with a solution for this. At first glance it appears to be more involved than I would like to accurately count the size in bytes of the contents of the values inside of a python dict.

@devonh devonh requested a review from a team as a code owner June 20, 2024 21:34
erikjohnston
erikjohnston previously approved these changes Jun 21, 2024
sygnal/gcmpushkin.py Outdated Show resolved Hide resolved
@devonh devonh requested a review from erikjohnston June 21, 2024 14:53
sygnal/gcmpushkin.py Outdated Show resolved Hide resolved
sygnal/gcmpushkin.py Outdated Show resolved Hide resolved
tests/test_gcm.py Outdated Show resolved Hide resolved
@devonh devonh requested a review from erikjohnston June 24, 2024 21:19
@devonh devonh merged commit 0b6717c into main Jun 26, 2024
5 checks passed
@devonh devonh deleted the devon/payload-size branch June 26, 2024 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants