Branch name does not gets escaped correctly

Please search for similar issues before creating a ticket.
All fields below are required.

Description

I currently encountered the issue that I couldn’t publish my results to codecov using the codecov-action.
I got the message:

[2021-08-31T17:20:33.085Z] ['error'] Error POSTing to https://codecov.io: 400 Invalid request parameters
[2021-08-31T17:20:33.085Z] ['error'] Error: Error uploading to https://codecov.io: Error: Bad Request

After having a look at the used url
https://codecov.io/upload/v4?package=github-action-2.0.3-uploader-0.1.0&token=<XXX>&branch=issues/#1&build=<XXX>&build_url=<XXX>&commit=<XXX>&job=Build&pr=&service=github-actions&slug=<XXX>&name=&tag=&flags=&parent=
I’v figured out that it was because of my branch have the name issues/#1 and it didn’t get url-encoded.
Note: If replaced some parts in url with <XXX> to shorten it a bit.

Commit SHAs

a46ebcc88453caee8e7bc84f3cd2bfd822e347d1

Repository

qualersoft/jmeter-gradle-plugin: Gradle plugin for using JMeter (github.com)

CI/CD or Build URL

#1 disabled local cache for test tasks · qualersoft/jmeter-gradle-plugin@a46ebcc (github.com)

Uploader

Github action codecov/codecov-action@v2
==> SHASUM file signed by key id 806bb28aed779869

5==> Uploader SHASUM verified (f4daf62bfc474b5aeebb25b3cf1a467b01f930b404ba7e618abc6141b72a04a9 codecov)

Codecov Output

[2021-09-02T21:00:45.505Z] ['info'] 
     _____          _
    / ____|        | |
   | |     ___   __| | ___  ___ _____   __
   | |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
   | |___| (_) | (_| |  __/ (_| (_) \ V /
    \_____\___/ \__,_|\___|\___\___/ \_/

  Codecov report uploader 0.1.0
[2021-09-02T21:00:45.517Z] ['info'] => Project root located at: /home/runner/work/jmeter-gradle-plugin/jmeter-gradle-plugin
[2021-09-02T21:00:45.518Z] ['info'] -> No token specified or token is empty
[2021-09-02T21:00:45.530Z] ['info'] Searching for coverage files...
[2021-09-02T21:00:45.547Z] ['info'] => Found 1 possible coverage files:
  build/reports/jacoco/test/jacocoTestReport.xml
[2021-09-02T21:00:45.547Z] ['info'] Processing /home/runner/work/jmeter-gradle-plugin/jmeter-gradle-plugin/build/reports/jacoco/test/jacocoTestReport.xml...
[2021-09-02T21:00:45.558Z] ['info'] Detected GitHub Actions as the CI provider.
[2021-09-02T21:00:45.558Z] ['info'] Pinging Codecov: https://codecov.io/upload/v4?package=github-action-2.0.3-uploader-0.1.0&token=*******&branch=issues/#1&build=1195724758&build_url=https%3A%2F%2Fgithub.com%2Fqualersoft%2Fjmeter-gradle-plugin%2Factions%2Fruns%2F1195724758&commit=a46ebcc88453caee8e7bc84f3cd2bfd822e347d1&job=Build&pr=&service=github-actions&slug=qualersoft/jmeter-gradle-plugin&name=&tag=&flags=&parent=
[2021-09-02T21:00:45.763Z] ['error'] Error POSTing to https://codecov.io: 400 Invalid request parameters
[2021-09-02T21:00:45.764Z] ['error'] Error: Error uploading to https://codecov.io: Error: Bad Request

Expected Results

Upload coverage reports succeed

Actual Results

Upload coverage reports failed

@mathze we released a new version of the uploader that fixes this issue. Are you still seeing an issue?

@tom I can verify.
I’ve created a test branch issues/#46 and upload succeed.
Output:

[2021-09-21T18:23:39.183Z] ['info'] Pinging Codecov: https://codecov.io/upload/v4?package=github-action-2.1.0-uploader-0.1.0&token=*******&branch=issues%2F%2346&build=1258782438&build_url=https%3A%2F%2Fgithub.com%2Fmathze%2Fgh-playground%2Factions%2Fruns%2F1258782438&commit=38bd0b38874e37f5907e275239431c7cc273085e&job=Build&pr=&service=github-actions&slug=mathze%2Fgh-playground&name=&tag=&flags=&parent=

Details at #46 updated workflow & fixed typo in bug-issue-template by mathze · Pull Request #47 · mathze/gh-playground (github.com)

Thank you very much

1 Like