Skip to content

PublishResult with / in the provider branch name fails #545

@scrocquesel

Description

@scrocquesel

Version information:

  • OS: Linux
  • PactNet Version: 5.0.1
  • .Net Version: 8
  • Pact Broker Version (if applicable): 2.107.1

Describe the bug
Trying to publish test results with provider branch "/refs/head/test", result in an error

2025-07-10T21:23:11.928119Z ERROR ThreadId(01) pact_verifier::pact_broker: Failed to push branch refs/head/test for provider version test
2025-07-10T21:23:11.928223Z ERROR ThreadId(01) pact_verifier: Publishing of verification results failed with an error: Link/Resource was not found - Request to pact broker path '/pacticipants/myprovider/branches/refs%2Fhead%2Ftest/versions/test' failed: 404 Not Found. URL: 'https://pactbroker.com/'

Steps To Reproduce

options.PublishResults(brokerConfig.ProviderVersion, publishOptions =>
                    {
                        publishOptions
                            .BuildUri("http://test")
                            .ProviderBranch("/refs/head/test");
                    });

Expected behavior
The provider verification result should be published to a branch with a slash. This is a supported value with the pact cli to publish consumer contract.

Log Output
See above

Additional context
Replacing / with - make it works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviortriageThis issue is yet to be triaged by a maintainerupstreamIndicates that an issue relates to an upstream problem (such as in pact-reference)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions