@@ -480,11 +480,35 @@ public string DefaultCommandPrefix
480480 /// </summary>
481481 /// <param name="name">The string to quote</param>
482482 /// <returns>The quoted string</returns>
483- private string QuoteName ( object name )
483+ private string QuoteName ( string name )
484484 {
485485 if ( name == null )
486486 return "''" ;
487- return "'" + name . ToString ( ) . Replace ( "'" , "''" ) + "'" ;
487+ return ( "'" + name . ToString ( ) . Replace ( "'" , "''" ) + "'" ) ;
488+ }
489+
490+ /// <summary>
491+ /// Return a single-quoted string using the AbsoluteUri member to ensure it is escaped correctly
492+ /// </summary>
493+ /// <param name="name">The Uri to quote</param>
494+ /// <returns>The quoted AbsoluteUri</returns>
495+ private string QuoteName ( Uri name )
496+ {
497+ if ( name == null )
498+ return "''" ;
499+ return QuoteName ( name . AbsoluteUri ) ;
500+ }
501+
502+ /// <summary>
503+ /// Return a single-quoted string from a Version object
504+ /// </summary>
505+ /// <param name="name">The Version object to quote</param>
506+ /// <returns>The quoted Version string</returns>
507+ private string QuoteName ( Version name )
508+ {
509+ if ( name == null )
510+ return "''" ;
511+ return QuoteName ( name . ToString ( ) ) ;
488512 }
489513
490514 /// <summary>
@@ -877,6 +901,10 @@ protected override void EndProcessing()
877901 ValidateUriParameterValue ( ProjectUri , "ProjectUri" ) ;
878902 ValidateUriParameterValue ( LicenseUri , "LicenseUri" ) ;
879903 ValidateUriParameterValue ( IconUri , "IconUri" ) ;
904+ if ( _helpInfoUri != null )
905+ {
906+ ValidateUriParameterValue ( new Uri ( _helpInfoUri ) , "HelpInfoUri" ) ;
907+ }
880908
881909 if ( CompatiblePSEditions != null && ( CompatiblePSEditions . Distinct ( StringComparer . OrdinalIgnoreCase ) . Count ( ) != CompatiblePSEditions . Count ( ) ) )
882910 {
@@ -949,7 +977,7 @@ protected override void EndProcessing()
949977
950978 BuildModuleManifest ( result , "RootModule" , Modules . RootModule , ! string . IsNullOrEmpty ( _rootModule ) , ( ) => QuoteName ( _rootModule ) , streamWriter ) ;
951979
952- BuildModuleManifest ( result , "ModuleVersion" , Modules . ModuleVersion , _moduleVersion != null && ! string . IsNullOrEmpty ( _moduleVersion . ToString ( ) ) , ( ) => QuoteName ( _moduleVersion . ToString ( ) ) , streamWriter ) ;
980+ BuildModuleManifest ( result , "ModuleVersion" , Modules . ModuleVersion , _moduleVersion != null && ! string . IsNullOrEmpty ( _moduleVersion . ToString ( ) ) , ( ) => QuoteName ( _moduleVersion ) , streamWriter ) ;
953981
954982 BuildModuleManifest ( result , "CompatiblePSEditions" , Modules . CompatiblePSEditions , _compatiblePSEditions != null && _compatiblePSEditions . Length > 0 , ( ) => QuoteNames ( _compatiblePSEditions , streamWriter ) , streamWriter ) ;
955983
@@ -973,7 +1001,7 @@ protected override void EndProcessing()
9731001
9741002 BuildModuleManifest ( result , "CLRVersion" , StringUtil . Format ( Modules . CLRVersion , Modules . PrerequisiteForDesktopEditionOnly ) , _ClrVersion != null && ! string . IsNullOrEmpty ( _ClrVersion . ToString ( ) ) , ( ) => QuoteName ( _ClrVersion ) , streamWriter ) ;
9751003
976- BuildModuleManifest ( result , "ProcessorArchitecture" , Modules . ProcessorArchitecture , _processorArchitecture . HasValue , ( ) => QuoteName ( _processorArchitecture ) , streamWriter ) ;
1004+ BuildModuleManifest ( result , "ProcessorArchitecture" , Modules . ProcessorArchitecture , _processorArchitecture . HasValue , ( ) => QuoteName ( _processorArchitecture . ToString ( ) ) , streamWriter ) ;
9771005
9781006 BuildModuleManifest ( result , "RequiredModules" , Modules . RequiredModules , _requiredModules != null && _requiredModules . Length > 0 , ( ) => QuoteModules ( _requiredModules , streamWriter ) , streamWriter ) ;
9791007
@@ -1003,7 +1031,7 @@ protected override void EndProcessing()
10031031
10041032 BuildPrivateDataInModuleManifest ( result , streamWriter ) ;
10051033
1006- BuildModuleManifest ( result , "HelpInfoURI" , Modules . HelpInfoURI , ! string . IsNullOrEmpty ( _helpInfoUri ) , ( ) => QuoteName ( _helpInfoUri ) , streamWriter ) ;
1034+ BuildModuleManifest ( result , "HelpInfoURI" , Modules . HelpInfoURI , ! string . IsNullOrEmpty ( _helpInfoUri ) , ( ) => QuoteName ( ( _helpInfoUri != null ) ? new Uri ( _helpInfoUri ) : null ) , streamWriter ) ;
10071035
10081036 BuildModuleManifest ( result , "DefaultCommandPrefix" , Modules . DefaultCommandPrefix , ! string . IsNullOrEmpty ( _defaultCommandPrefix ) , ( ) => QuoteName ( _defaultCommandPrefix ) , streamWriter ) ;
10091037
@@ -1128,7 +1156,7 @@ private void ValidateUriParameterValue(Uri uri, string parameterName)
11281156 {
11291157 Dbg . Assert ( ! String . IsNullOrWhiteSpace ( parameterName ) , "parameterName should not be null or whitespace" ) ;
11301158
1131- if ( uri != null && ! Uri . IsWellFormedUriString ( uri . ToString ( ) , UriKind . Absolute ) )
1159+ if ( uri != null && ! Uri . IsWellFormedUriString ( uri . AbsoluteUri , UriKind . Absolute ) )
11321160 {
11331161 var message = StringUtil . Format ( Modules . InvalidParameterValue , uri ) ;
11341162 var ioe = new InvalidOperationException ( message ) ;
0 commit comments