From e19beb65cd20e13557ccb6232ff2e0b651c79d8f Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Tue, 21 Oct 2025 10:14:35 -0700 Subject: [PATCH] Skip tracking tag level when inside script or style content. --- Modules/RSCore/Sources/RSCoreObjC/striphtml.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Modules/RSCore/Sources/RSCoreObjC/striphtml.c b/Modules/RSCore/Sources/RSCoreObjC/striphtml.c index 366b705cf..5aedc59e3 100644 --- a/Modules/RSCore/Sources/RSCoreObjC/striphtml.c +++ b/Modules/RSCore/Sources/RSCoreObjC/striphtml.c @@ -62,7 +62,10 @@ size_t stripHTML(const char *input, size_t inputLength, // Handle tag opening if (c == '<') { - tagLevel++; + // Only track tag level when not inside script/style + if (!inScript && !inStyle) { + tagLevel++; + } // Check for script or style tags if (in + 7 < inEnd && matchesTag(in + 1, "script")) { @@ -102,7 +105,8 @@ size_t stripHTML(const char *input, size_t inputLength, // Handle tag closing if (c == '>') { - if (tagLevel > 0) { + // Only track tag level when not inside script/style + if (!inScript && !inStyle && tagLevel > 0) { tagLevel--; } in++;