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: 5 additions & 0 deletions .changeset/normalize-store-fqdn-suffix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/cli-kit': patch
---

Only treat `.myshopify.io` (not any `shopify.io` suffix) as an already-normalized store FQDN
33 changes: 33 additions & 0 deletions packages/cli-kit/src/public/node/context/fqdn.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,37 @@ describe('normalizeStore', () => {
// Then
expect(got).toEqual('example.myshopify.com')
})

test('preserves local dev store names ending in .myshopify.io', async () => {
// Given
vi.mocked(serviceEnvironment).mockReturnValue(Environment.Local)

// When
const got = normalizeStoreFqdn('example.myshopify.io')

// Then
expect(got).toEqual('example.myshopify.io')
})

test('does not treat other domains ending in shopify.io as already normalized', async () => {
// Given
vi.mocked(serviceEnvironment).mockReturnValue(Environment.Production)

// When
const got = normalizeStoreFqdn('exampleshopify.io')

// Then
expect(got).toEqual('exampleshopify.io.myshopify.com')
})

test('does not treat nested domains ending in shopify.io as already normalized', async () => {
// Given
vi.mocked(serviceEnvironment).mockReturnValue(Environment.Production)

// When
const got = normalizeStoreFqdn('example.exampleshopify.io')

// Then
expect(got).toEqual('example.exampleshopify.io.myshopify.com')
})
})
2 changes: 1 addition & 1 deletion packages/cli-kit/src/public/node/context/fqdn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export function normalizeStoreFqdn(store: string): string {
}
}
const containDomain = (storeFqdn: string) =>
storeFqdn.endsWith('.myshopify.com') || storeFqdn.endsWith('shopify.io') || storeFqdn.endsWith('.shop.dev')
storeFqdn.endsWith('.myshopify.com') || storeFqdn.endsWith('.myshopify.io') || storeFqdn.endsWith('.shop.dev')
return containDomain(storeFqdn) ? storeFqdn : addDomain(storeFqdn)
}

Expand Down
Loading