Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix: maxChars slices bytes not characters, injecting U+FFFD into /text and /html responses (PIN-022)

Luigi Agostie9380ba73f57
diff --git a/internal/handlers/text.go b/internal/handlers/text.go
index 7bfbd699..e1e716b4 100644
--- a/internal/handlers/text.go
+++ b/internal/handlers/text.go
@@ -75,7 +75,7 @@ func (h *Handlers) HandleText(w http.ResponseWriter, r *http.Request) {
} else if modalOpen {
err = h.Bridge.CallFunctionOnNode(tCtx, modalNodeID,
`function() { return this.innerText || this.textContent || ''; }`, nil, &text)
- extraction = textExtraction{Text: text, Mode: extractionRaw, RawLength: len(text), RawKnown: true}
+ extraction = textExtraction{Text: text, Mode: extractionRaw, RawLength: utf8.RuneCountInString(text), RawKnown: true}
} else {
extraction, err = h.extractDocumentText(tCtx, mode, targetFrameID)
}