Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default empty value of Configuration.safe_chars_for_path_param seems wrong #26

Open
kapsh opened this issue Sep 13, 2020 · 0 comments
Open
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@kapsh
Copy link

kapsh commented Sep 13, 2020

Reproducible example (using https://teamcity.jetbrains.com/viewType.html?buildTypeId=DemoProjects_TeamCity_Net_Build for build having artifacts):

import dohq_teamcity, logging

logging.basicConfig(level=logging.DEBUG)
logging.getLogger("urllib3").setLevel(logging.DEBUG)
teamcity = dohq_teamcity.TeamCity("https://teamcity.jetbrains.com/guestAuth", auth=None)
build = teamcity.builds.get("buildType:(id:DemoProjects_TeamCity_Net_Build),number:8")
build.get_children("/Clock.Console/linux-x64")

Result:

"HTTP Status 400 – Bad Request".
It can be seen in debug log that request has been made to URL /guestAuth/app/rest/builds/id%3A3101739/artifacts/children%2FClock.Console%2Flinux-x64 which is obviously wrong: / should not be escaped in artifacts paths. Relevant part from swagger.json:

  /app/rest/builds/{buildLocator}/artifacts/children{path}:
    get:
      tags:
      - Build
      operationId: getChildren
      parameters:
      - name: path
        in: path
        required: true
        type: string
        pattern: (/.*)?

After setting teamcity.configuration.safe_chars_for_path_param = "/" (default value was empty string) URL in request becomes correct /guestAuth/app/rest/builds/id%3A3101739/artifacts/children/Clock.Console/linux-x64 (method call still requires workaround from #25 to work completely).

Suggestion would be to set Configuration.safe_chars_for_path_param to / by default, though it's not clear what other parts this can break.

@Tim55667757 Tim55667757 added the bug Something isn't working label Sep 15, 2020
@allburov allburov added the help wanted Extra attention is needed label Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Development

No branches or pull requests

6 participants