Raytha is a powerful CMS with an easy-to-use interface and fast performance. It offers custom content types, a template engine, and various access controls. It supports multiple storage providers and an automatically generated REST API. Upgrade your development workflow with Raytha.
MIT License
164
stars
31
forks
source link
Crash if user enters malformed date in `Content Item` #214
When using a
date field
type in content item, a user entered a malformed date (06/08/0022) and this resulted in the following crash error:Fixed the crash for the customer temporarily by just updating the bad date in the database directly.
To fix:
In our
JsonQueryEngine
we have two places where we convert varchar to datetime:https://github.com/RaythaHQ/raytha/blob/c5a74ae2e9dbdd71c6956e78352c06b0bd0a0b6d/src/Raytha.Infrastructure/JsonQueryEngine/RaythaDbJsonQueryEngine.cs#L380
https://github.com/RaythaHQ/raytha/blob/c5a74ae2e9dbdd71c6956e78352c06b0bd0a0b6d/src/Raytha.Infrastructure/JsonQueryEngine/RaythaDbJsonQueryEngine.cs#L472
We should consider changing it from CONVERT to TRY_CONVERT as described below:
This would return null on bad data which we can handle accordingly instead of just crashing out.