Skip to content

Commit a6e0647

Browse files
Merge pull request #36 from jyonke/Bug--$AuthenticationType-variable-referenced-when-not-in-required-parameter-set-#35
bugfix: #35 AuthenticationType reference
2 parents 5345e01 + a389eb8 commit a6e0647

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

src/public/Repository/New-NexusNugetProxyRepository.ps1

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function New-NexusNugetProxyRepository {
2-
<#
2+
<#
33
.SYNOPSIS
44
Creates a new NuGet Proxy Repository
55
@@ -114,7 +114,7 @@ $ProxyParameters = @{
114114
115115
New-NexusNugetProxyRepository @ProxyParameters
116116
#>
117-
[CmdletBinding(HelpUri = 'https://nexushell.dev/New-NexusNugetProxyRepository/',DefaultParameterSetname="Default")]
117+
[CmdletBinding(HelpUri = 'https://nexushell.dev/New-NexusNugetProxyRepository/', DefaultParameterSetname = "Default")]
118118
Param(
119119
[Parameter(Mandatory)]
120120
[String]
@@ -208,7 +208,7 @@ New-NexusNugetProxyRepository @ProxyParameters
208208
$EnableAutoBlocking = $false,
209209

210210
[Parameter()]
211-
[ValidateRange(0,10)]
211+
[ValidateRange(0, 10)]
212212
[String]
213213
$ConnectionRetries,
214214

@@ -242,8 +242,6 @@ New-NexusNugetProxyRepository @ProxyParameters
242242

243243
$FullUrlSlug = $formatUrl + "/proxy"
244244

245-
$AuthenticationType = $AuthenticationType.ToLower()
246-
247245
$body = @{
248246
name = $Name
249247
online = [bool]$Online
@@ -288,23 +286,24 @@ New-NexusNugetProxyRepository @ProxyParameters
288286

289287
if ($UseAuthentication) {
290288

291-
switch($AuthenticationType){
289+
switch ($AuthenticationType) {
292290
'Username' {
293291
$authentication = @{
294-
type = $AuthenticationType
292+
type = $AuthenticationType.ToLower()
295293
username = $Credential.UserName
296294
password = $Credential.GetNetworkCredential().Password
297-
ntlmHost = ''
295+
ntlmHost = ''
298296
ntlmDomain = ''
299297
}
300298

301299
$body.httpClient.Add('authentication', $authentication)
302300
}
303301

304302
'NTLM' {
305-
if(-not $HostnameFqdn -and $DomainName){
303+
if (-not $HostnameFqdn -and $DomainName) {
306304
throw "Parameter HostnameFqdn and DomainName are required when using WindowsNTLM authentication"
307-
} else {
305+
}
306+
else {
308307
$authentication = @{
309308
type = $AuthenticationType
310309
username = $Credential.UserName

src/public/Repository/New-NexusRawProxyRepository.ps1

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ New-NexusRawProxyRepository @ProxyParameters
121121
$ProxyRemoteUrl,
122122

123123
[Parameter(Mandatory)]
124-
[ValidateSet('Inline','Attachment')]
124+
[ValidateSet('Inline', 'Attachment')]
125125
[String]
126126
$ContentDisposition,
127127

@@ -230,8 +230,6 @@ New-NexusRawProxyRepository @ProxyParameters
230230
}
231231
process {
232232

233-
$AuthenticationType = $AuthenticationType.ToLower()
234-
235233
$body = @{
236234
name = $Name
237235
online = [bool]$Online
@@ -263,8 +261,8 @@ New-NexusRawProxyRepository @ProxyParameters
263261
useTrustStore = [bool]$UseNexusTrustStore
264262
}
265263
}
266-
routingRule = $RoutingRule
267-
raw = @{
264+
routingRule = $RoutingRule
265+
raw = @{
268266
contentDisposition = $ContentDisposition
269267
}
270268
}
@@ -274,7 +272,7 @@ New-NexusRawProxyRepository @ProxyParameters
274272
switch ($AuthenticationType) {
275273
'Username' {
276274
$authentication = @{
277-
type = $AuthenticationType
275+
type = $AuthenticationType.ToLower()
278276
username = $Credential.UserName
279277
password = $Credential.GetNetworkCredential().Password
280278
ntlmHost = ''

0 commit comments

Comments
 (0)