Skip to content

Commit 44700e4

Browse files
committed
fix(lib/core): Allow Cache-Key deletion with NULL
1 parent 854ef78 commit 44700e4

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

doc/100-General/10-Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
1919

2020
* [#814](https://github.com/Icinga/icinga-powershell-framework/pull/814) Fixes random chars function to truly generate unpredictable character sequences and to replace `Get-Random` which is not entirely secure
2121
* [#815](https://github.com/Icinga/icinga-powershell-framework/pull/815) Fixes a possible crash for `Test-IcingaAddTypeExist`, causing the Icinga for Windows installation to fail when third party components are checked which are malfunctioning
22+
* [#829](https://github.com/Icinga/icinga-powershell-framework/pull/829) Fixes `Set-IcingaCacheData` to properly remove cache files in case `$null` is passed as value
2223

2324
## 1.13.3 (2025-05-08)
2425

lib/core/cache/Set-IcingaCacheData.psm1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ function Set-IcingaCacheData()
3838
$CacheTmpFile = [string]::Format('{0}.tmp', $CacheFile);
3939
$cacheData = @{ };
4040

41+
if ($null -eq $Value) {
42+
if (Test-Path $CacheTmpFile) {
43+
Remove-ItemSecure -Path $CacheTmpFile -Retries 5 -Force | Out-Null;
44+
}
45+
if (Test-Path $CacheFile) {
46+
Remove-ItemSecure -Path $CacheFile -Retries 5 -Force | Out-Null;
47+
}
48+
return;
49+
}
50+
4151
if ((Test-IcingaCacheDataTempFile -Space $Space -CacheStore $CacheStore -KeyName $KeyName)) {
4252
Copy-IcingaCacheTempFile -CacheFile $CacheFile -CacheTmpFile $CacheTmpFile;
4353
}

0 commit comments

Comments
 (0)