Skip to content

Commit e7385a4

Browse files
Reject whitespace domain filters
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent ebf7320 commit e7385a4

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

src/functions/public/Domains/Get-DomeneshopDomain.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ function Get-DomeneshopDomain {
3939
# A domain-name filter for list requests.
4040
[Parameter(ParameterSetName = 'List')]
4141
[ValidateNotNullOrEmpty()]
42+
[ValidateScript({ -not [string]::IsNullOrWhiteSpace($_) })]
4243
[string] $Domain,
4344

4445
# The numeric identifier of a specific domain.

tests/Get-DomeneshopDomain.Tests.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,10 @@ Describe 'Get-DomeneshopDomain' {
4242
It 'rejects non-positive domain IDs' {
4343
{ Get-DomeneshopDomain -Context 'demo' -DomainID 0 } | Should -Throw
4444
}
45+
46+
It 'rejects whitespace-only domain filters' {
47+
{ Get-DomeneshopDomain -Context 'demo' -Domain ' ' } | Should -Throw
48+
49+
Should -Invoke Invoke-DomeneshopApiRequest -Times 0 -Exactly
50+
}
4551
}

0 commit comments

Comments
 (0)