Skip to content

ManagementAPI getLogEvents() is double encoding the LogEventFilter's withQuery() value #419

@CalebeGeazi

Description

@CalebeGeazi

Describe the problem you'd like to have solved

When building a LogEventFilter object that adds a date range query via the LogEventsFilter.withQuery() method, and then passing this object to the ManagementAPI getLogEvents() method the resulting q query string parameter is being double encoded. This is causing a 400 Bad Request error.

Reproduction

Here's the code snippet for setting the query parameter and making the getLogEvents() call:

LocalDate date = LocalDate.now().minus(Period.ofDays(30));
String query = "date:[" + date + " TO *]";
LogEventFilter filter = new LogEventFilter()
    .withQuery(query)
    .withPage(pageNumber, 10);

Request<LogEventsPage> request = managementApi.users().getLogEvents(userId, filter);
request.execute();

Environment

  • Version of this library used: Tested on 1.34.0 and 1.40.1
  • Version of the platform or framework used, if applicable: Java 1.8
  • Other relevant versions (language, server software, OS, browser): N/A
  • Other modules/plugins/libraries that might be involved: N/A

Describe the ideal solution

I would expect the query to only be URLEncoded once.

Alternatives and current work-arounds

Manually build the request to call the /users/{user-id}/logs endpoint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis points to a verified bug in the code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions