Skip to content

[API] Endpoint to add review does not accept newline characters in the body #17727

@christopherhero

Description

@christopherhero

Sylius version affected: All versions 1.13, 1.14 and 2.0

Description
Using a newline character in the comment field in the endpoint: api/v2/shop/product-reviews causes an error.
This issue has been occurring since the commit in symfony/http-foundation symfony/http-foundation@168b77c, which fixes the issue GHSA-mrqx-rp3w-jpjp

Using the Symfony version, e.g. v6.4.13, which is one of the versions without the mentioned patch, the problem does not occur.

Example

url: api/v2/shop/product-reviews

Request Body:

{
	"rating": 5,
	"product": "everyday_white_basic_t_shirt",
	"title": "Review title",
	"comment": "review comment \n test 123"
}

Response:

{
	"@context": "/api/v2/contexts/Error",
	"@type": "hydra:Error",
	"hydra:title": "An error occurred",
	"hydra:description": "Invalid URI: A URI cannot contain CR/LF/TAB characters."
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIAPIs related issues and PRs.Potential BugPotential bugs or bugfixes, that needs to be reproduced.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions