Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Actions/Github-Helper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ function GetDependencies {

if (Test-Path $downloadName -PathType Container) {
$folder = Get-Item $downloadName
Get-ChildItem -Path $folder | ForEach-Object {
# -LiteralPath: $folder is already resolved and may contain wildcard chars (e.g. ']' from a branch name)
Get-ChildItem -LiteralPath $folder | ForEach-Object {
if ($currentMask -like '*TestApps') {
$downloadedList += @("($($_.FullName))")
}
Expand Down
1 change: 1 addition & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### Issues

- Fix "filename or extension is too long" error when validating settings on PS5.1 with large settings JSON
- Fix dependency apps not being resolved when the branch name contains a `]` character (the dependency folder was matched as a wildcard pattern instead of enumerated literally, resulting in 0 apps being published)

## v9.1

Expand Down
32 changes: 32 additions & 0 deletions Tests/GitHub-Helper.Test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,36 @@ Describe "GitHub-Helper Tests" {
$result = GetLatestRelease -token 'dummy' -api_url 'https://api.github.com' -repository 'test/repo' -ref 'releases/v26x'
$result.tag_name | Should -Be '26.3.0'
}

It 'GetDependencies resolves .app files when the dependency folder path contains a glob metacharacter (])' {
# A branch name may contain ']' (git forbids '[' but allows ']'), which ends up in the
# downloaded dependency folder name. GetDependencies must enumerate that folder with
# -LiteralPath; using -Path would treat ']' as a wildcard and return the folder itself
# instead of the .app files inside it.
$saveToPath = (New-Item -ItemType Directory -Path (Join-Path $([System.IO.Path]::GetTempPath()) $([System.IO.Path]::GetRandomFileName()))).FullName
try {
$branch = 'bugs_Bug-638182--master]-Postserviceorder'
$depFolder = New-Item -ItemType Directory -Path (Join-Path $saveToPath "MyProj-$branch-Apps-PR1-20260709")
[System.IO.File]::WriteAllBytes((Join-Path $depFolder "App1.app"), [byte[]](1, 2, 3))
[System.IO.File]::WriteAllBytes((Join-Path $depFolder "App2.app"), [byte[]](4, 5, 6))

$probingPath = [PSCustomObject]@{
release_status = 'thisBuild'
buildMode = 'Default'
projects = 'MyProj'
branch = $branch
repo = 'https://github.com/test/repo'
}

$result = @(GetDependencies -probingPathsJson $probingPath -saveToPath $saveToPath -masks @('Apps'))

$result | Should -HaveCount 2
$result | ForEach-Object { $_ | Should -BeLike '*.app' }
$result | Should -Contain (Join-Path $depFolder "App1.app")
$result | Should -Contain (Join-Path $depFolder "App2.app")
}
finally {
Remove-Item -Path $saveToPath -Recurse -Force -ErrorAction SilentlyContinue
}
}
}
Loading