Repository navigation
Write the push notification settings into the service worker as escaped strings - #1127
Open
KrzysztofPajak wants to merge 1 commit into
Open
KrzysztofPajak wants to merge 1 commit into
KrzysztofPajak wants to merge 1 commit into
Conversation
…ed strings The settings went into firebase-messaging-sw.js between plain quotes, so a quote, a backslash or a line break typed in one of them broke the script and with it the push notifications. Each line was also found by a Contains check, so a value that mentioned another key took over that key's line on the next save. Values are now written as JSON string literals, and a line is matched by the key it starts with.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type: bugfix
Issue
Settings > Push notifications writes its values into
firebase-messaging-sw.jsbetween plain quotes. A quote, a backslash or a line break typed in a field broke the service worker script, and push notifications with it.Each line was also found with
Contains(key), so a value that mentioned another key (an API key containingappId, say) took over that key's line on the next save.Solution
Values are written as JSON string literals (
JsonSerializer.Serialize), which escape quotes, backslashes, line breaks and</>. A line is matched by the key it starts with.Breaking changes
None. Plain values are written exactly as before.
Testing
", save.wwwroot/firebase-messaging-sw.jsholdsapiKey: "...\u0022...", and the script parses.SettingControllerPushNotificationsTestscovers the escaping and a value that names another key.