-
Notifications
You must be signed in to change notification settings - Fork 12
Description
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.