Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1853,10 +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 endpointHosts = SUPPORTED_ADOBE_ANNOTATION_ENDPOINTS.map(endpoint => removeProtocolFromURL(endpoint))

const apihostIsCustom = !endpointHosts.includes(cleanApihost)

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/)

Expand Down
16 changes: 16 additions & 0 deletions test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Loading