Skip to content

Floating point in fields is not working #14172

@eloo-abi

Description

@eloo-abi

Description:

Hi,
i've discovered a bug using incoming webhooks.
The bug occurs when a field with an value of type double is send. Then an error is thrown.
With wrapping the value in quotes it works, but the problem is that my system is not wrapping it. Also it works in Slack without quotes.

Steps to reproduce:

  1. Create incoming webhook without script
  2. Send message to incoming webhook with the following body
{
    "attachments": [
        {
            "color": "#D63232",
            "fallback": "[Alerting] My Alert",
            "fields": [
                {
                    "short": true,
                    "title": "Some value",
                    "value": 1.8503078660265208
                }
            ],
            "ts": 1555507262
        }
    ],
    "parse": "full"
}
  1. Send the same body with quotes around the numeric value of value and you see it working.

Expected behavior:

My alert is shown in RocketChat as expected

Actual behavior:

Then the following response will received and not message is coming up in the channel

{
    "success": false,
    "error": "Match error: Match error: Failed Match.OneOf, Match.Maybe or Match.Optional validation in field value"
}

Server Setup Information:

  • Version of Rocket.Chat Server: 0.74.3
  • Deployment Method: docker
  • Number of Running Instances: 1
  • MongoDB Version: 4.0.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions