Skip to content

Library is not usable with DependencyTrack instance deployed on a subpath #51

@szczepad-colenio

Description

@szczepad-colenio

We're deploying dependency-track under a subpath (e.g. org.com/dependency-track for the frontend and org.com/dependency-track/api and org.com/dependency-track/health for the backend)

While using the client-go library and creating a new Client we're getting the following error-message:
ERROR Could not initialize DependencyTrack client error="failed to fetch version information: Not Found (status: 404)"

On first look the reason for this behavior is the general behavior of URL.Parse in Client.NewRequest. See below.

u, err := c.baseURL.Parse(path)

When using url.Parse any existing path of the url will be replaced by the path to parse. This behavior is visible in the documentation of URL.Parse or more specifically in URL.ResolveReference

A more flexible solution might be to use URL.JoinPath instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    defectSomething isn't workinggood first issueGood for newcomersp2Non-critical bugs, and features that help organizations to identify and reduce risksize/SSmall effort

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions