You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: shopping cards lose merchant_domain when the merchant URL has no scheme #874
server/src/lib/shopping-cards.js has its own private extractHostname (line 167), used for merchant_domain on every card type (lines 227, 253, 299, 349). It returns null whenever new URL() throws — for example on a merchant URL without a scheme such as shop.example.com/p/1.
The shared helper extractDomain in server/src/lib/citation-rows.js (line 32) does the same normalization but recovers the host from scheme-less URLs with a regex fallback, because such URLs do occur in AI answers.
The result is that a shopping card with a scheme-less merchant link is stored with merchant_domain: null and drops out of any merchant grouping.
Expected behavior
merchant_domain is shop.example.com for shop.example.com/p/1, the same as for https://shop.example.com/p/1.
Suggested fix
Import extractDomain from citation-rows.js and delete the local copy. Add a case to server/src/lib/shopping-cards.test.js with a scheme-less merchant URL.
Run yarn test from server/ before opening the PR — see CONTRIBUTING.md.
Activity
shahzainshafique commentedon Oct 3, 2026
Hi @gkhngyk,
I've worked on a fix for this issue. The PR #888 is created and linked with this issue. Please review.
fix(shopping): recover merchant_domain from scheme-less merchant URLs (…