Skip to content

[Bug]: Incorrect Json Escape #892

Closed
Closed

Description

@Wesley273

What happened?

Here, the input has been escaped.

private A2AHttpClient.PostBuilder createPostBuilder(String url, PayloadAndHeaders payloadAndHeaders) throws JsonProcessingException, InvalidProtocolBufferException {
        log.fine(JsonFormat.printer().print((MessageOrBuilder)payloadAndHeaders.getPayload()));
        A2AHttpClient.PostBuilder postBuilder = ((A2AHttpClient.PostBuilder)((A2AHttpClient.PostBuilder)this.httpClient.createPost().url(url)).addHeader("Content-Type", "application/json")).body(JsonFormat.printer().print((MessageOrBuilder)payloadAndHeaders.getPayload()));
        if (payloadAndHeaders.getHeaders() != null) {
            for(Map.Entry<String, String> entry : payloadAndHeaders.getHeaders().entrySet()) {
                postBuilder.addHeader((String)entry.getKey(), (String)entry.getValue());
            }
        }

        return postBuilder;
    }

Some input, for example:

## 订阅指令\n请根据以下 <事件主题>、<订阅条件>、<上报事件数据格式> 及 <预期输出> 信息

HTML Symbols will be escaped, And it is very difficult to return to normal.

## 订阅指令\\n请根据以下 \u003c事件主题\u003e、\u003c订阅条件\u003e、\u003c上报事件数据格式\u003e 及 \u003c预期输出\u003e 信息

Relevant log output

None

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added theissue type on May 22, 2026
  2. spandey1702 commented on May 27, 2026

    @spandey1702

    Hi, I'd like to work on this. Could someone assign it to me? I think this can be fixed by the HTML escaping in createPostBuilder() by re-serializing through Gson with disableHtmlEscaping()

  3. kabir commented on Jun 2, 2026

    @kabir
    Collaborator

    @spandey1702 sorry I missed this, feel free to work on it.

    BTW would you be able to put the error description in English? :-)

  4. Wesley273 commented on Jun 2, 2026

    @Wesley273
    Author

    @spandey1702 sorry I missed this, feel free to work on it.

    BTW would you be able to put the error description in English? :-)
    Raw Input in English May like this:

    ## Subscription Instructions\nPlease follow the information below regarding <Event Topic>, <Subscription Criteria>, <Event Data Reporting Format>, and <Expected Output>
    

    The key point is to include special symbols such as line breaks and angle brackets.

  5. added 5 commits that reference this issue on Jun 23, 2026
    be87058
    b3c3a28
    e1ac72a
    b738b24
    76698ca
  6. added a commit that references this issue on Jun 25, 2026
    9808c46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions