FIX: Wrong type in category_id param input (#304)

* FIX: Wrong type in category_id param input

We will dasherize category_id. The dasherize function accepts a string,
but we don't type-check it, so the default null may be passed in. This
will cause a type error and crash the front-end.
This commit is contained in:
锦心
2024-08-05 20:11:16 +08:00
committed by GitHub
parent dd05e35e0f
commit 41dfa217ca
2 changed files with 69 additions and 0 deletions
@@ -164,6 +164,7 @@ export default class ParamInput extends Component {
}
dasherizeCategoryId(value) {
value = String(value || "");
const isPositiveInt = /^\d+$/.test(value);
if (!isPositiveInt && value !== dasherize(value)) {
return dasherize(value);