Skip to content

Preserve percent-encoded branch names in gh pr create display URLs #13546

@abd0-omar

Description

@abd0-omar

Describe the bug

When creating a PR in the browser, gh pr create prints a display URL based on the parsed URL path. For branch names that require URL encoding (for example, quotes), the displayed URL is unescaped and can be invalid.

Affected version

2.85.0

Steps to reproduce the behavior

  1. Create and checkout a branch named test-"quoted"-branch-pr.
  2. Run gh pr create --web and proceed with the “continue in browser” flow.
  3. Observe the displayed URL in the terminal.

Expected vs actual behavior

Expected: the display URL preserves percent-encoding, for example: https://github.com/OWNER/REPO/compare/...test-%22quoted%22-branch-pr

Actual: the display URL is unescaped, for example: https://github.com/OWNER/REPO/compare/...test-"quoted"-branch-pr

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority-3Affects a small number of users or is largely cosmetic

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions