File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
packages/contentstack-config/src/commands/config/set Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -114,9 +114,7 @@ export default class RegionSetCommand extends BaseCommand<typeof RegionSetComman
114114 composableStudioUrl = this . transformUrl ( cma , 'composable-studio-api' ) ;
115115 }
116116 if ( ! assetManagementUrl ) {
117- // Use UI host as base and append /am/api
118- const baseUrl = uiHost . replace ( / \/ $ / , '' ) ; // Remove trailing slash if present
119- assetManagementUrl = `${ baseUrl } /am/api` ;
117+ assetManagementUrl = this . transformUrl ( uiHost , '/am/api' ) ;
120118 }
121119 let customRegion : Region = {
122120 cda,
@@ -164,6 +162,12 @@ export default class RegionSetCommand extends BaseCommand<typeof RegionSetComman
164162 }
165163 }
166164 transformUrl ( url : string , replacement : string ) : string {
165+ // If replacement contains '/', treat it as a path to append to the base URL
166+ if ( replacement . includes ( '/' ) ) {
167+ const baseUrl = url . replace ( / \/ $ / , '' ) ; // Remove trailing slash if present
168+ return `${ baseUrl } ${ replacement } ` ;
169+ }
170+
167171 let transformedUrl = url . replace ( 'api' , replacement ) ;
168172 if ( transformedUrl . startsWith ( 'http' ) ) {
169173 transformedUrl = transformedUrl . split ( '//' ) [ 1 ] ;
You can’t perform that action at this time.
0 commit comments