forked from microsoft/StoreBroker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix character escaping issues during config generation
> This is a re-implementation of microsoft#198 for the v2 branch. Many years ago, microsoft#24 attempted to properly escape special characters in a string by creating its own `Get-EscapedJsonValue` function, but that only escaped `\`, `\t`, `\r`, `\n`. That doesn't cover all the possible characters needing to be encoded though. A user had a `<` character (which was properly JSON-escaped as `\u003c`), but that didn't get escaped by this logic, and thus caused an issue when trying to get decoded by `ConvertFrom-Json` later on. Back then, `Get-EscapedJsonValue` must have seemed like a _good_ idea, but looking back at this code with more experience, it's not clear to me why I didn't just use `ConvertTo-Json` directly. Doing that now. One additional update that needed to be done however was to replace `//` with `\\` in `tag` and `notesForCertification`. This isn't _completely_ correct, but not doing so meant that anything after that would be improperly flagged as a comment by `Remove-Comment` and then removed. This was found because the same user had a URL in their `notesForCertification` and the closing JSON was getting stripped out incorrectly as soon as it found the `//` in `https://....`.
- Loading branch information
1 parent
4d67f87
commit 9db745e
Showing
5 changed files
with
17 additions
and
57 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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