diff --git a/CHANGELOG.md b/CHANGELOG.md index ffa5883d..71cbe54a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,21 @@ # StoreBroker PowerShell Module ## Changelog +## [1.19.4](https://github.com/Microsoft/StoreBroker/tree/1.19.4) - (2020/08/14) +### Fixes: + +- Fixes the logic for config generation when `tag` or `notesForCertification` from Partner Center + had an encoded character or a URL value. The encoded character wasn't getting re-encoded properly + in the generated config, and everything after the `//` in the URL was being treated as a comment. + +More Info: [[pr]](https://github.com/Microsoft/StoreBroker/pull/https://github.com/Microsoft/StoreBroker/pull/198) | [[cl]](https://github.com/Microsoft/StoreBroker/commit/...) + +Author: [**@HowardWolosky**](https://github.com/HowardWolosky) + ## [1.19.3](https://github.com/Microsoft/StoreBroker/tree/1.19.3) - (2020/04/10) ### Fixes: -+ Updated all of the Partner Center URL's to follow the new location format. +- Updated all of the Partner Center URL's to follow the new location format. More Info: [[pr]](https://github.com/Microsoft/StoreBroker/pull/https://github.com/Microsoft/StoreBroker/pull/185) | [[cl]](https://github.com/Microsoft/StoreBroker/commit/0fbb6b9a702cf0edf52e8f5ef6d920fb859fc954) @@ -13,7 +24,7 @@ Author: [**@cartwrightluke**](https://github.com/cartwrightluke) ## [1.19.2](https://github.com/Microsoft/StoreBroker/tree/1.19.2) - (2018/12/14) ### Fixes: -+ Updated the logic for finding the appxbundle/appx manifests to use direct instead of relative +- Updated the logic for finding the appxbundle/appx manifests to use direct instead of relative paths More Info: [[cl]](https://github.com/Microsoft/StoreBroker/commit/9f884ff367bca72c604e57f5ce9daad6b0f4b277) diff --git a/StoreBroker/Helpers.ps1 b/StoreBroker/Helpers.ps1 index 00afcf9f..199a00d6 100644 --- a/StoreBroker/Helpers.ps1 +++ b/StoreBroker/Helpers.ps1 @@ -321,57 +321,6 @@ function Get-SHA512Hash return [System.BitConverter]::ToString($sha512.ComputeHash($utf8.GetBytes($PlainText))) -replace '-', '' } -function Get-EscapedJsonValue -{ -<# - .SYNOPSIS - Escapes special characters within a string for use within a JSON value. - - .DESCRIPTION - Escapes special characters within a string for use within a JSON value. - - The Git repo for this module can be found here: http://aka.ms/StoreBroker - - .PARAMETER Value - The string that needs to be escaped - - .EXAMPLE - Get-EscapedJsonValue -Value 'This is my "quote". Look here: c:\windows\' - - Returns back the string 'This is my \"quote\". Look here: c:\\windows\\' - - .OUTPUTS - System.String - A string with special characters escaped for use within JSON. - - .NOTES - Normalizes newlines and carriage returns to always be \r\n. -#> - [CmdletBinding()] - param( - [Parameter( - Mandatory, - ValueFromPipeline)] - [AllowNull()] - [AllowEmptyString()] - [string] $Value - ) - - # The syntax of -replace is a bit confusing, so it's worth a note here. - # The first parameter is a regular expression match pattern. The second parameter is a replacement string. - # So, when we try to do "-replace '\\', '\\", that's matching a single backslash (which has to be - # escaped within the match regular expression as a double-backslash), and replacing it with a - # string containing literally two backslashes. - # (And as a reminder, PowerShell's escape character is actually the backtick (`) and not backslash (\).) - - # \, ", - $escaped = $Value -replace '\\', '\\' -replace '"', '\"' -replace '\t', '\t' - - # Now normalize actual CR's and LF's with their control codes. We'll ensure all variations are uniformly formatted as \r\n - $escaped = $escaped -replace '\r\n', '\r\n' -replace '\r', '\r\n' -replace '\n', '\r\n' - - return $escaped -} - function ConvertTo-Array { <# diff --git a/StoreBroker/PackageTool.ps1 b/StoreBroker/PackageTool.ps1 index f359c70f..b47990e7 100644 --- a/StoreBroker/PackageTool.ps1 +++ b/StoreBroker/PackageTool.ps1 @@ -125,16 +125,16 @@ function Get-StoreBrokerConfigFileContentForIapId $updated = $updated -replace '"lifetime": ".*",', "`"lifetime`": `"$($sub.lifetime)`"," $updated = $updated -replace '"contentType": ".*",', "`"contentType`": `"$($sub.contentType)`"," - $tag = Get-EscapedJsonValue -Value $sub.tag - $updated = $updated -replace '"tag": ""', "`"tag`": `"$tag`"" + $tag = ConvertTo-Json -InputObject ($sub.tag -replace '//', '\\') # Ensure // doesn't get stripped out as a comment later on. + $updated = $updated -replace '"tag": ""', "`"tag`": $tag" $keywords = $sub.keywords | ConvertTo-Json -Depth $script:jsonConversionDepth if ($null -eq $keywords) { $keywords = "[ ]" } $updated = $updated -replace '(\s+)"keywords": \[.*(\r|\n)+\s*\]', "`$1`"keywords`": $keywords" # NOTES FOR CERTIFICATION - $notesForCertification = Get-EscapedJsonValue -Value $sub.notesForCertification - $updated = $updated -replace '"notesForCertification": ""', "`"notesForCertification`": `"$notesForCertification`"" + $notesForCertification = ConvertTo-Json -InputObject ($sub.notesForCertification -replace '//', '\\') # Ensure // doesn't get stripped out as a comment later on. + $updated = $updated -replace '"notesForCertification": ""', "`"notesForCertification`": $notesForCertification" return $updated } @@ -361,8 +361,8 @@ function Get-StoreBrokerConfigFileContentForAppId } # NOTES FOR CERTIFICATION - $notesForCertification = Get-EscapedJsonValue -Value $sub.notesForCertification - $updated = $updated -replace '"notesForCertification": ""', "`"notesForCertification`": `"$notesForCertification`"" + $notesForCertification = ConvertTo-Json -InputObject ($sub.notesForCertification -replace '//', '\\') # Ensure // doesn't get stripped out as a comment later on. + $updated = $updated -replace '"notesForCertification": ""', "`"notesForCertification`": $notesForCertification" return $updated } diff --git a/StoreBroker/StoreBroker.psd1 b/StoreBroker/StoreBroker.psd1 index a5fcb64e..c4a48fa3 100644 --- a/StoreBroker/StoreBroker.psd1 +++ b/StoreBroker/StoreBroker.psd1 @@ -6,7 +6,7 @@ CompanyName = 'Microsoft Corporation' Copyright = 'Copyright (C) Microsoft Corporation. All rights reserved.' - ModuleVersion = '1.19.3' + ModuleVersion = '1.19.4' Description = 'Provides command-line access to the Windows Store Submission REST API.' RootModule = 'StoreIngestionApi'