Skip to content

fix: support country-specific Google domains#3

Open
yusiwen wants to merge 1 commit into
MatrixAges:masterfrom
yusiwen:fix/support-country-specific-google-domains
Open

fix: support country-specific Google domains#3
yusiwen wants to merge 1 commit into
MatrixAges:masterfrom
yusiwen:fix/support-country-specific-google-domains

Conversation

@yusiwen

@yusiwen yusiwen commented May 17, 2026

Copy link
Copy Markdown

Problem

The extension only works on https://www.google.com/*. On country-specific
Google domains like www.google.com.hk, www.google.co.uk, www.google.de,
the content script is never injected and the copy feature always fails.

Root Cause

The domain https://www.google.com/* was hardcoded in 5 locations
across 2 files:

File Occurrences
public/manifest.json host_permissions + content_scripts.matches
src/background/index.ts documentUrlPatterns (context menu)

The runtime URL checks (isAIMode / udm=50 query param) were already
domain-agnostic — no changes needed there.

Fix

Replaced every occurrence of https://www.google.com/* with 4 match
patterns that collectively cover all Google country domains:

https://www.google.com/*
https://www.google.*/*
https://www.google.com.*/*
https://www.google.co.*/*

This works because Chrome extension match patterns only support
single-label wildcards (*), so multiple patterns are required to
cover both single-TLD domains (.de, .fr) and two-part TLDs
(.com.hk, .co.uk).

Testing

  • npm run build succeeds
  • Content script will now be injected on any country-specific Google
    domain (test by visiting https://www.google.com.hk/search?udm=50)

The extension was hardcoded to https://www.google.com/* in 5 places,
preventing it from working on any country-specific Google domain.
Chrome extension match patterns only allow single-label wildcards (*),
so 4 patterns are needed to cover all Google TLD variants:

- https://www.google.com/*       (main domain)
- https://www.google.*/*         (single TLD: .de, .fr, .it, ...)
- https://www.google.com.*/*     (two-part TLD: .com.hk, .com.au, ...)
- https://www.google.co.*/*      (two-part TLD: .co.uk, .co.jp, ...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant