Skip to content

Page type: isRootPath reads a backslash URL as the site root #903

Closed

Description

@nc9

isRootPath (packages/page-classifier/src/rules-fallback.ts) strips the scheme and looks for the first "/" in the string. An unnormalised URL that uses a backslash as the path separator, such as https://example.com\about, has no "/" after the host, so the function reads it as a root path and the homepage rule would label the page homepage with confidence 1.

Crawler URLs are normalised before they reach the classifier, so this does not show up in an audit today. The classifier is also a library entry point (classifyPage(html, url)), and its documentation says a non-root page never gets homepage (#900), a claim that assumes a normalised URL.

Acceptance Criteria

  • isRootPath("https://example.com\\about") is false.
  • isRootPath parses the URL with the platform URL parser (or an equivalent that treats a backslash like a slash for special schemes) and keeps the existing true cases: https://example.com, https://example.com/, https://example.com/?a=1, https://example.com/#top.
  • A URL that cannot be parsed returns false, not true.
  • Tests cover the backslash form, a userinfo form (https://[email protected]/a) and an unparseable string.

Activity

  1. added
    bug
    size: XS
    on Oct 17, 2026
  2. WilliamK112 commented on Oct 21, 2026

    @WilliamK112
    Contributor

    I would like to take this. I will switch isRootPath to the platform URL parser, preserve the documented root/query/fragment cases, return false on parse failures, and add focused regressions for backslash paths, userinfo, and malformed input.

  3. WilliamK112 commented on Oct 21, 2026

    @WilliamK112
    Contributor

    I checked current main at 73c2efe before editing, but packages/page-classifier and rules-fallback.ts are not present, and repository code search finds no isRootPath symbol. I will not manufacture a replacement in a different classifier surface. If this issue targets another branch or a package that is about to land, please point me to that base and I can revisit it.

  4. WilliamK112 commented on Oct 27, 2026

    @WilliamK112
    Contributor

    The page-classifier package and isRootPath are now on main, so I am resuming this previously claimed issue. I will keep the fix limited to URL parsing plus the acceptance-test cases, then open a focused PR.

  5. added a commit that references this issue on Oct 27, 2026
    73038b0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsize: XS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions