Skip to content

Sites: Normalize pasted domain searches - #113356

Open
mauropereiira wants to merge 4 commits into
trunkfrom
fix/dotmsd-1363-site-search-protocol
Open

Sites: Normalize pasted domain searches#113356
mauropereiira wants to merge 4 commits into
trunkfrom
fix/dotmsd-1363-site-search-protocol

Conversation

@mauropereiira

@mauropereiira mauropereiira commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Fixes DOTMSD-1363

Proposed Changes

  • Strip an optional http:// or https:// prefix and one trailing slash from the site search sent to the API.
  • Keep the search value shown in the input unchanged.
  • Cover bare, HTTP-prefixed, and HTTPS-prefixed domain searches, with and without a trailing slash, in an integration test.

Why are these changes being made?

The sites API expects a bare domain. Protocol-prefixed searches can return no results, and URLs copied from a browser address bar normally include a trailing slash that also prevents a match. Normalizing only the outbound API query makes these common pasted forms behave consistently without rewriting what the user typed.

Testing Instructions

Author verification passed on Calypso Live build-192092: all six bare/HTTP/HTTPS forms, with and without a trailing slash, returned the same controlled site while preserving the entered value.

  1. Open /sites with an account containing a controlled test site.
  2. Search for that site using its bare domain, with and without a trailing slash, and confirm it appears.
  3. Repeat with https:// before the domain, with and without a trailing slash, and confirm the same site appears.
  4. Repeat with http:// before the domain, with and without a trailing slash, and confirm the same site appears.
  5. Confirm each entered value remains unchanged in the search input.
  6. Run yarn test-client client/dashboard/sites/test/index.test.tsx --runInBand.
  7. Run yarn test-client --findRelatedTests client/dashboard/sites/index.tsx client/dashboard/sites/test/index.test.tsx --runInBand.
  8. Run yarn typecheck-client.

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • For UI changes, have you tested the affected components in dark mode?
  • Have you tested accessibility for your changes? Ensure the feature remains usable with various user agents (e.g., browsers), interfaces (e.g., keyboard navigation), and assistive technologies (e.g., screen readers) (PCYsg-S3g-p2).
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@mauropereiira mauropereiira changed the title Sites: Accept protocol-prefixed domain searches Sites: Normalize pasted domain searches Aug 6, 2026
@mauropereiira
mauropereiira marked this pull request as ready for review August 6, 2026 19:03
@mauropereiira
mauropereiira requested a review from a team as a code owner August 6, 2026 19:03
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Aug 6, 2026
@mauropereiira

Copy link
Copy Markdown
Contributor Author

@claude /review

@mauropereiira

Copy link
Copy Markdown
Contributor Author

Before and after

Bare domain

Before After
Bare domain search before fix Without trailing slash
Bare domain search after fix without trailing slash

With trailing slash
Bare domain search after fix with trailing slash

HTTPS URL

Before After
HTTPS URL search before fix Without trailing slash
HTTPS URL search after fix without trailing slash

With trailing slash
HTTPS URL search after fix with trailing slash

HTTP URL

Before After
HTTP URL search before fix Without trailing slash
HTTP URL search after fix without trailing slash

With trailing slash
HTTP URL search after fix with trailing slash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants