@@ -46,9 +46,6 @@ public class HtmlContentStrategy implements SpamDetectionStrategy {
4646 private final static Logger logger = LogManager .getLogger ();
4747 private final SpamContentExtractor contentExtractor ;
4848
49- @ Value ("${app.batch.spam-detection.html.max-elements:50}" )
50- private int maxHtmlElements ;
51-
5249 @ Value ("${app.batch.spam-detection.html.max-ratio:0.7}" )
5350 private double maxHtmlToTextRatio ;
5451
@@ -107,12 +104,6 @@ public SpamDetectionResult detectSpam(SpamDetectionContext context) {
107104 return patternResult ;
108105 }
109106
110- // Check HTML element count
111- SpamDetectionResult elementCountResult = checkHtmlElementCount (mapModel );
112- if (elementCountResult .isSpam ()) {
113- return elementCountResult ;
114- }
115-
116107 // Check HTML to text ratio
117108 SpamDetectionResult ratioResult = checkHtmlToTextRatio (htmlContent );
118109 if (ratioResult .isSpam ()) {
@@ -184,42 +175,6 @@ private SpamDetectionResult checkHtmlPatterns(String htmlContent) {
184175 return SpamDetectionResult .notSpam ();
185176 }
186177
187- /**
188- * Checks if the HTML element count exceeds the threshold.
189- */
190- private SpamDetectionResult checkHtmlElementCount (MapModel mapModel ) {
191- long htmlElementCount = countHtmlElements (mapModel );
192-
193- if (htmlElementCount > maxHtmlElements ) {
194- return new SpamDetectionResult (true ,
195- "Excessive HTML elements detected" ,
196- String .format ("Found %d HTML elements, threshold: %d" , htmlElementCount , maxHtmlElements ),
197- SpamStrategyType .HTML_CONTENT );
198- }
199-
200- return SpamDetectionResult .notSpam ();
201- }
202-
203- /**
204- * Counts HTML elements in the mindmap model.
205- * Only counts suspicious/non-formatting HTML elements, excluding common text
206- * formatting tags.
207- */
208- private long countHtmlElements (MapModel mapModel ) {
209- long count = 0 ;
210-
211- // Count HTML tags in all notes
212- for (Topic topic : mapModel .getAllTopics ()) {
213- String note = topic .getNote ();
214- if (note != null && !note .trim ().isEmpty () && contentExtractor .isHtmlContent (note )) {
215- // Count only suspicious HTML tags (exclude text formatting tags)
216- count += countSuspiciousHtmlElements (note );
217- }
218- }
219-
220- return count ;
221- }
222-
223178 /**
224179 * Counts only suspicious HTML elements, excluding common text formatting tags.
225180 * Text formatting tags (h1-h6, p, b, strong, i, em, u, ul, ol, li, br, span,
@@ -260,7 +215,8 @@ private long countSuspiciousHtmlElements(String htmlContent) {
260215 "cite" , "q" , // Citations and quotes
261216 "time" , // Time elements
262217 "wbr" , // Word break opportunities
263- "img" // Images - handled by HtmlContentValidator, not considered spam here
218+ "img" , // Images - handled by HtmlContentValidator, not considered spam here
219+ "font" // Font styling
264220 );
265221
266222 long suspiciousCount = 0 ;
0 commit comments