Skip to content

Commit

Permalink
Merge pull request #320 from openstad/bugfix/validation-possibly-oper…
Browse files Browse the repository at this point in the history
…ates-on-null

Validation in api did accept nulls but did not handle them correctly …
  • Loading branch information
LorenzoJokhan authored Nov 9, 2023
2 parents ba0fcbc + 9ab202a commit 7418e7a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/models/Idea.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ module.exports = function (db, sequelize, DataTypes) {
validate: {
textLength(value) {
// We need to undo the sanitization before we can check the length
let len = htmlToText.fromString(value).length;
let len = htmlToText.fromString(value || '').length;
let summaryMinLength =
(this.config &&
this.config.ideas &&
Expand Down Expand Up @@ -241,7 +241,7 @@ module.exports = function (db, sequelize, DataTypes) {
allowNull: !this.publishDate,
validate: {
textLength(value) {
let len = sanitize.summary(value.trim()).length;
let len = sanitize.summary(value || ''.trim()).length;
let descriptionMinLength =
(this.config &&
this.config.ideas &&
Expand Down

1 comment on commit 7418e7a

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Published new image: openstad/api:devel-7418e7a

Please sign in to comment.