Skip to content

view: route paths are not URL-encoded, and a malformed % hangs the page #2071

Closed

Description

@shunichironomura

Warning

This content was written by an AI agent and must be verified by a human developer. After human verification, this alert may be removed.

Found in the review of #2057, which adds the experimental view. It does not block that PR; #2059 fixed the findings that did. Paths refer to #2059's head.

Problem

parseRoute and formatRoute in web/view/src/route.ts:

  • The path is neither encoded nor decoded. A path with a space or non-ASCII characters cannot be opened, and an address the page wrote with replaceState fails after a reload.
  • The ref is decoded with decodeURIComponent, which throws URIError on #o/r@%/a.gcl. main.ts parses the route at module top level, so the page stays at "loading…".
  • The Route type allows { ref: null, base: "x" }, which means nothing.
  • Repository names starting with . (such as .github) are rejected, as are GitHub URLs with a line anchor (#L10).

Proposed fix

  • Encode and decode each path segment, and check for ., .. and empty segments after decoding.
  • Return null when decoding fails.
  • Make Route a discriminated union.

Activity

  1. added
    bugSomething isn't working
    webviewThe experimental view (web/view, graphcal view, graphcal/viewModel)
    on Oct 14, 2026
  2. added a commit that references this issue on Oct 17, 2026
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

    bugSomething isn't workingwebviewThe experimental view (web/view, graphcal view, graphcal/viewModel)

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions