Skip to content

WebAPI can't encode some special symbols in exception message and turns 400 error into 500 #1280

Open
@alantipo

Description

@alantipo

When a request is sent that is suppose to return 400 {"error":{"code":"Application_StringExceededLength","message":"The length of the string is X, but it must be less than or equal to N characters. Value: ***}}, WebAPI turns into 500 internal server error if the message contains some characters like emoji.

Assemblies affected

Reproduce steps

Open postman and try to send a patch request for a page with a field with limited number of characters with a value in the request that is longer then this limit and that contains an emoji (i.e. 😔).

Expected result

You are supposed to see 400, Application_StringExceededLength, with the the message "The length of the string is X, but it must be less than or equal to N characters. Value: your original message"

Actual result

500 internal server error

Additional detail

It is not just the emoji issue. Some other special characters are affected as well. No pattern for that seems to be obvious.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions