Skip to content

New-ModuleManifest will not accept space characters in Uris #3336

@daleecc

Description

@daleecc

Steps to reproduce

$uri = ([System.Uri]"http://tfs:8080/tfs/ISD/Automation/_versionControl?path=%24%2FAutomation%20Test")

New-ModuleManifest `
    -Path "./Test.psd1" `
    -ModuleVersion "2.0.0.0" `
    -ProjectUri $uri

Expected behavior

Manifest is created with a ProjectUri value of:

http://tfs:8080/tfs/ISD/Automation/_versionControl?path=%24%2FAutomation%20Test

Actual behavior

The following error is thrown as the uri appears to have been decoded prior to validation:

New-ModuleManifest : The specified value 'http://tfs:8080/tfs/ISD/Automation/_versionControl?path=$/Automation Test' is invalid, try again with a valid value.
At C:\Work\TFS\Automation\Deployment Automation\Development\PipelineImprovements\ServerIntegrationManagement\Modules\ServerIntegrationManagementClientCore\Test.ps1:5 char:1
+ New-ModuleManifest `
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (ProjectUri:String) [New-ModuleManifest], InvalidOperationException
    + FullyQualifiedErrorId : Modules_InvalidUri,Microsoft.PowerShell.Commands.NewModuleManifestCommand

Testing has found that it is %20 (space character) which is causing the issue. The uri validates with [System.Uri]::IsWellFormedUriString with a return value of $true

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.0.10586.117
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.10586.117
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.WG-Cmdletsgeneral cmdlet issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions