ensureProperlyEncodedUrl truncates PR links at "=" in the title and leaves path spaces unencoded

Author: ManoharPaturiCreated Sep 18, 2026Updated Sep 18, 2026
Labelsbugp3

what happens

ensureProperlyEncodedUrl mangles "Create a PR" links in two ways:

  1. a = inside a query value truncates everything after it. title parse a=b comes out as parse a
  2. spaces in the URL path stay raw whenever a query string exists, so the markdown link breaks

repro

typescript
import { ensureProperlyEncodedUrl } from "./src/github/operations/comment-logic";

ensureProperlyEncodedUrl("https://github.com/o/r/compare/main...branch?expand=1&title=parse a=b&body=x")
// -> "...&title=parse+a&body=x"   (the =b is gone)

ensureProperlyEncodedUrl("https://github.com/o/r/my branch/compare/main...b?quick_pull=1")
// -> "https://github.com/o/r/my branch/compare/..."   (raw space kept)

why

the query loop destructures pair.split("=") so the value keeps only the first segment, and the space-fixing branch only runs when there is no query string.

expected

values survive intact (title=parse+a%3Db) and path spaces get encoded no matter what.

env: main a4f54ef

Source: anthropics/claude-code-action