Commit 667caa46 authored by Richard Bruskiewich's avatar Richard Bruskiewich Committed by Matija Obreza
Browse files

Applying a little local htmlSanitizer to this Module

more cropService htmlsanitization?

Partially remove htmlsanitation as not required
parent a197e0fa
...@@ -34,6 +34,7 @@ import org.genesys2.server.persistence.domain.CropRuleRepository; ...@@ -34,6 +34,7 @@ import org.genesys2.server.persistence.domain.CropRuleRepository;
import org.genesys2.server.persistence.domain.CropTaxonomyRepository; import org.genesys2.server.persistence.domain.CropTaxonomyRepository;
import org.genesys2.server.persistence.domain.TaxonomyRepository; import org.genesys2.server.persistence.domain.TaxonomyRepository;
import org.genesys2.server.service.CropService; import org.genesys2.server.service.CropService;
import org.genesys2.server.service.HtmlSanitizer;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
...@@ -59,6 +60,9 @@ public class CropServiceImpl implements CropService { ...@@ -59,6 +60,9 @@ public class CropServiceImpl implements CropService {
@Autowired @Autowired
TaxonomyRepository taxonomyRepository; TaxonomyRepository taxonomyRepository;
@Autowired
private HtmlSanitizer htmlSanitizer;
@Override @Override
public Crop getCrop(String shortName) { public Crop getCrop(String shortName) {
...@@ -212,7 +216,7 @@ public class CropServiceImpl implements CropService { ...@@ -212,7 +216,7 @@ public class CropServiceImpl implements CropService {
crop.setShortName(shortName); crop.setShortName(shortName);
crop.setName(name); crop.setName(name);
crop.setDescription(StringUtils.defaultIfBlank(description, null)); crop.setDescription(StringUtils.defaultIfBlank(htmlSanitizer.sanitize(description), null));
crop.setI18n(StringUtils.defaultIfBlank(i18n, null)); crop.setI18n(StringUtils.defaultIfBlank(i18n, null));
cropRepository.save(crop); cropRepository.save(crop);
LOG.info("Registered crop: " + crop); LOG.info("Registered crop: " + crop);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment