From bda2bb832d200101ef9ec7293a838c74592bf090 Mon Sep 17 00:00:00 2001 From: Jesse MacFadyen Date: Tue, 12 Aug 2025 14:45:12 -0700 Subject: [PATCH 1/3] Compare host against known urls --- src/utils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils.js b/src/utils.js index 054c181..4241cad 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1853,10 +1853,11 @@ function getActionUrls (appConfig, /* istanbul ignore next */ isRemoteDev = fals const config = replacePackagePlaceHolder(appConfig) const cleanApihost = removeProtocolFromURL(config.ow.apihost) const cleanHostname = removeProtocolFromURL(config.app.hostname) + const apihostIsCustom = !SUPPORTED_ADOBE_ANNOTATION_ENDPOINTS.includes(config.ow.apihost) - const apihostIsCustom = cleanApihost !== removeProtocolFromURL(config.ow.defaultApihost) const hostnameIsCustom = cleanHostname !== removeProtocolFromURL(config.app.defaultHostname) + aioLogger.debug('apihostIsCustom ', apihostIsCustom, 'hostnameIsCustom', hostnameIsCustom) // second condition allows users to point to its own http local ow stack const isHttp = isLocalDev || !!config.ow.apihost.match(/^http:\/\/localhost/) From af7ae418715b4bb5fd30ddb9a44ead2369f65507 Mon Sep 17 00:00:00 2001 From: Jesse MacFadyen Date: Tue, 12 Aug 2025 14:55:47 -0700 Subject: [PATCH 2/3] Update src/utils.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.js b/src/utils.js index 4241cad..c92f893 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1857,7 +1857,7 @@ function getActionUrls (appConfig, /* istanbul ignore next */ isRemoteDev = fals const hostnameIsCustom = cleanHostname !== removeProtocolFromURL(config.app.defaultHostname) - aioLogger.debug('apihostIsCustom ', apihostIsCustom, 'hostnameIsCustom', hostnameIsCustom) + aioLogger.debug('apihostIsCustom', apihostIsCustom, 'hostnameIsCustom', hostnameIsCustom) // second condition allows users to point to its own http local ow stack const isHttp = isLocalDev || !!config.ow.apihost.match(/^http:\/\/localhost/) From f880ffc77543e8e133a54da1bceb4ddb06593a82 Mon Sep 17 00:00:00 2001 From: Jesse MacFadyen Date: Tue, 12 Aug 2025 15:14:03 -0700 Subject: [PATCH 3/3] check against host without protocol --- src/utils.js | 6 ++++-- test/utils.test.js | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/utils.js b/src/utils.js index c92f893..75045e0 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1853,11 +1853,13 @@ function getActionUrls (appConfig, /* istanbul ignore next */ isRemoteDev = fals const config = replacePackagePlaceHolder(appConfig) const cleanApihost = removeProtocolFromURL(config.ow.apihost) const cleanHostname = removeProtocolFromURL(config.app.hostname) - const apihostIsCustom = !SUPPORTED_ADOBE_ANNOTATION_ENDPOINTS.includes(config.ow.apihost) + const endpointHosts = SUPPORTED_ADOBE_ANNOTATION_ENDPOINTS.map(endpoint => removeProtocolFromURL(endpoint)) + + const apihostIsCustom = !endpointHosts.includes(cleanApihost) const hostnameIsCustom = cleanHostname !== removeProtocolFromURL(config.app.defaultHostname) - aioLogger.debug('apihostIsCustom', apihostIsCustom, 'hostnameIsCustom', hostnameIsCustom) + aioLogger.debug('apihostIsCustom ', apihostIsCustom, 'hostnameIsCustom ', hostnameIsCustom) // second condition allows users to point to its own http local ow stack const isHttp = isLocalDev || !!config.ow.apihost.match(/^http:\/\/localhost/) diff --git a/test/utils.test.js b/test/utils.test.js index 61f63b3..aba254b 100644 --- a/test/utils.test.js +++ b/test/utils.test.js @@ -2191,6 +2191,22 @@ describe('getActionUrls', () => { expect(result).toEqual(expect.objectContaining(expected)) }) + // this test proves we still have an issue with non default package actions + // eslint-disable-next-line jest/no-commented-out-tests + // test('should not fail if default package has no actions with deploy-service apihost', () => { + // const expected = { + // 'sample-app-1.0.0/action-sequence': 'https://fake_ns.adobeio-static.net/api/v1/web/sample-app-1.0.0/action-sequence', + // 'pkg2/thataction': 'https://fake_ns.adobeioruntime.net/api/v1/pkg2/thataction', + // 'pkg2/thatsequence': 'https://fake_ns.adobeio-static.net/api/v1/web/pkg2/thatsequence' + // } + // config.ow.apihost = 'https://deploy-service.app-builder.adp.adobe.io/runtime' + // config.app.hostname = 'adobeio-static.net' + // config.manifest.full.packages.pkg2.actions.thataction.web = false + // delete config.manifest.full.packages.__APP_PACKAGE__.actions + // const result = utils.getActionUrls(config, false, false) + // expect(result).toEqual(expect.objectContaining(expected)) + // }) + test('urls with action keys when legacy on', () => { const expected = { 'pkg2/thataction': 'https://fake_ns.adobeio-static.net/api/v1/web/pkg2/thataction',