feat: sanitize short description

This commit is contained in:
Matthieu Bessat 2020-08-04 19:09:31 +02:00
parent 89fdda0122
commit bac94738fd
2 changed files with 6 additions and 1 deletions

View file

@ -55,6 +55,11 @@ export default class DelegateController {
proposedVersion.contacts.peoples = proposedVersion.contacts.peoples.filter((p: any) => !p.isResponsable) proposedVersion.contacts.peoples = proposedVersion.contacts.peoples.filter((p: any) => !p.isResponsable)
} }
// sanitize short description
if (Utils.isStrUsable(proposedVersion.shortDescription)) {
proposedVersion.shortDescription = proposedVersion.shortDescription.replace(/\n/g, '')
}
// sanitize long description // sanitize long description
if (Utils.isStrUsable(proposedVersion.descriptionLong)) { if (Utils.isStrUsable(proposedVersion.descriptionLong)) {
proposedVersion.descriptionLong = proposedVersion.descriptionLong.replace(/\n/g, '') proposedVersion.descriptionLong = proposedVersion.descriptionLong.replace(/\n/g, '')

View file

@ -51,7 +51,7 @@ export default class PublicController {
return { return {
_id: o._id, _id: o._id,
name: version.name, name: version.name,
description: version.descriptionShort, description: version.descriptionShort.replace(/\n/g, ''),
thumbnail: version.thumbnail.key, thumbnail: version.thumbnail.key,
tags: version.tags === null ? 'tags_not_found' : version.tags, tags: version.tags === null ? 'tags_not_found' : version.tags,
slug: o.get('slugs')[o.get('slugs').length -1] slug: o.get('slugs')[o.get('slugs').length -1]