@@ -34,17 +34,20 @@ export class Jira implements IJira {
34
34
this . baseUrl = getConfigurationByKey ( CONFIG . BASE_URL ) || '' ;
35
35
36
36
if ( this . baseUrl && getGlobalStateConfiguration ( ) ) {
37
- const parsedUrl = url . parse ( this . baseUrl ) ;
37
+ // prepare config for jira-connector
38
+ let host = this . baseUrl ;
39
+ const protocol = host . indexOf ( 'https://' ) >= 0 ? 'https' : 'http' ;
40
+ host = host . replace ( 'https://' , '' ) . replace ( 'http://' , '' ) ;
41
+ const portPosition = host . indexOf ( ':' ) ;
42
+ const port = portPosition !== - 1 ? host . substring ( portPosition + 1 ) : undefined ;
43
+ if ( portPosition !== - 1 ) {
44
+ host = host . substring ( 0 , portPosition ) ;
45
+ }
46
+ // TODO - manage subfolder
38
47
// host from parsedUrl.href because the base url can have subfolder
39
- const host = parsedUrl . href . replace ( parsedUrl . protocol + '//' , '' ) ;
48
+ // const host = parsedUrl.href.replace(parsedUrl.protocol + '//', '');
40
49
const [ username , password ] = getGlobalStateConfiguration ( ) . split ( CREDENTIALS_SEPARATOR ) ;
41
-
42
- this . jiraInstance = new jiraClient ( {
43
- host : host ,
44
- port : parsedUrl . port ,
45
- protocol : parsedUrl . protocol ,
46
- basic_auth : { username, password }
47
- } ) ;
50
+ this . jiraInstance = new jiraClient ( { host, port, protocol, basic_auth : { username, password } } ) ;
48
51
49
52
// custom event
50
53
// solve this issue -> https://github.com/floralvikings/jira-connector/issues/115
0 commit comments