RoyDefined / WebDoomer

WebDoomer is a fast and efficient Zandronum and QZandronum server browser as a web app.
GNU General Public License v3.0
4 stars 0 forks source link

Zod throws errors when parsing server that has a player with invalid ping #17

Closed RoyDefined closed 5 months ago

RoyDefined commented 5 months ago

Describe the bug Zod throws an error on a server because a player has invalid ping. This error is thrown:

[
  {
    "code": "too_small",
    "minimum": 0,
    "type": "number",
    "inclusive": true,
    "exact": false,
    "message": "Number must be greater than or equal to 0",
    "path": [
      "playerDataCollection",
      0,
      "ping"
    ]
  }
]

Triggered because a player had a negative ping value even though the value must be positive:

"ping": -31536,

The question would be if these things should be prevented on the frontend or if Zod should accept these invalid values. I'd go with the former.

Steps to reproduce Mostly depends on if you happen to encounter one while browsing.

Expected behavior The server is parser properly and will display the server.

Screenshots N/A

Additional context N/A

RoyDefined commented 5 months ago

Fixed in 9871c80.