mirror of https://github.com/ghostfolio/ghostfolio
Browse Source
`@IsOptional()` from class-validator only skips validation for `undefined` or `null` - not for empty string `""`. The asset profile dialog submits `url: ""` when the optional URL field is left blank, so `@IsUrl()` runs and the form fails with "url must be a URL address" despite URL being documented as optional. Fix: add a `@Transform` that coerces empty/whitespace-only strings to `undefined`, letting `@IsOptional()` short-circuit the validation chain. Same pattern as the `comment` field in `update-account.dto.ts`. Applied to both `UpdateAssetProfileDto` (the form path in the bug repro) and `CreateAssetProfileDto` (same flaw, same flow). Platform DTOs are left alone since their `url` field is required (not optional). Closes #6811.pull/6822/head
3 changed files with 14 additions and 0 deletions
Loading…
Reference in new issue