fix topic subscription when @ and + are encoded - #8553
Conversation
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
FirebaseMessaging.subscribeToTopic()/unsubscribeFromTopic()produced a 400 on any topic containing%, even though the documented grammar is[a-zA-Z0-9-_.~%]{1,900}.Introduced in firebase-messaging 25.1.0 (BoM 34.15.0, 16 Jun 2026) when FID registration landed (#8087) and
TopicSubscriptionClientstarted concatenating the topic unescaped intohttps://fcmregistrations.googleapis.com/v1/projects/{id}/registrations/{fid}/topicSubscriptions/{topic}:{op}.The server percent-decodes the path before validating, so fields like
%2Bor%40become + / @ and the request is rejected.This is still present in 25.1.1 / 25.1.2. Pre-25.1.0 (GmsRpc, last good BoM 34.14.0 / messaging 25.0.2) sent the topic as a
gcm.topicvalue, so % survived.This PR percent-escapes the topic path segment (
%→%25) on both subscribe and unsubscribe so the wire form matches the documented name. Same class of bug as firebase/quickstart-ios#242, fixed by firebase-ios-sdk#220.