:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(shopify): tolerate a trailing dot in the store subdomain (#68846)
Tom Owers5cad61dd7ad4
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/shopify.py b/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/shopify.pyindex 6963a8578872..b7c6394376ee 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/shopify.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/shopify.py@@ -290,6 +290,9 @@ def normalize_store_id(raw: str) -> str:store_id = store_id.removeprefix("admin.shopify.com/store/")# Drop any path/query/fragment that rode along with a pasted URL.store_id = store_id.split("/", 1)[0].split("?", 1)[0].split("#", 1)[0]+ # A trailing dot (FQDN form, e.g. "my-store.myshopify.com.") otherwise defeats the suffix+ # strip below and leaves a value the subdomain regex rejects.+ store_id = store_id.rstrip(".")# Strip the domain suffix, looping to collapse an accidental double suffix.while store_id.endswith(".myshopify.com"):store_id = store_id.removesuffix(".myshopify.com")diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/tests/test_store_id.py b/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/tests/test_store_id.pyindex a0c5dbd40942..8c8ff4fd2229 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/tests/test_store_id.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/tests/test_store_id.py@@ -21,6 +21,9 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.shopify.sh("https://admin.shopify.com/store/my-store/products", "my-store"),# Accidental double suffix collapses back to the bare subdomain.("my-store.myshopify.com.myshopify.com", "my-store"),+ # A trailing dot (FQDN form) is tolerated rather than rejected.+ ("my-store.myshopify.com.", "my-store"),+ ("https://my-store.myshopify.com./", "my-store"),("store123", "store123"),],)