@@ -20,11 +20,37 @@ export class DTSConnectionCustomPromptStep<T extends IDTSConnectionWizardContext
2020 return ! context . newDTSConnectionSetting && context . dtsConnectionType === ConnectionType . Custom ;
2121 }
2222
23- private validateInput ( name : string | undefined ) : string | undefined {
24- name = name ? name . trim ( ) : '' ;
25- if ( ! validationUtils . hasValidCharLength ( name ) ) {
23+ private validateInput ( connectionString : string | undefined ) : string | undefined {
24+ connectionString = connectionString ? connectionString . trim ( ) : '' ;
25+
26+ // Check for basic character length validation
27+ if ( ! validationUtils . hasValidCharLength ( connectionString ) ) {
2628 return validationUtils . getInvalidCharLengthMessage ( ) ;
2729 }
30+
31+ // Check if the connection string contains the required "Endpoint=" pattern
32+ const endpointMatch = connectionString . match ( / E n d p o i n t = ( [ ^ ; ] + ) / ) ;
33+ if ( ! endpointMatch ) {
34+ return localize ( 'invalidDTSConnectionStringFormat' , 'DTS connection string must contain an "Endpoint=" parameter. Expected format: "Endpoint=<URL>;Authentication=<AuthType>"' ) ;
35+ }
36+
37+ // Validate that the endpoint URL is properly formatted
38+ const endpoint = endpointMatch [ 1 ] ;
39+ try {
40+ const url = new URL ( endpoint ) ;
41+ // Ensure it's using a valid protocol
42+ if ( ! [ 'http:' , 'https:' ] . includes ( url . protocol ) ) {
43+ return localize ( 'invalidDTSEndpointProtocol' , 'DTS endpoint must use HTTP or HTTPS protocol. Found: {0}' , url . protocol ) ;
44+ }
45+ } catch ( error ) {
46+ return localize ( 'invalidDTSEndpointURL' , 'DTS endpoint is not a valid URL: {0}' , endpoint ) ;
47+ }
48+
49+ // Check if the connection string contains an Authentication parameter
50+ if ( ! connectionString . match ( / A u t h e n t i c a t i o n = / ) ) {
51+ return localize ( 'missingDTSAuthentication' , 'DTS connection string must contain an "Authentication=" parameter. Expected format: "Endpoint=<URL>;Authentication=<AuthType>"' ) ;
52+ }
53+
2854 return undefined ;
2955 }
3056}
0 commit comments