From be268f2f7699fd7bc4f8659e7d717cc4befd1522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20=C3=85hall?= Date: Wed, 23 Aug 2023 11:11:43 +0200 Subject: [PATCH] Changed ScriptEscape from []byte to string --- script.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script.go b/script.go index 6c0be95..7c5abc5 100644 --- a/script.go +++ b/script.go @@ -5,11 +5,11 @@ import ( "regexp" ) -func ScriptEscape(source []byte) (escaped []byte) { +func ScriptEscape(source string) (escaped string) { rxp2 := regexp.MustCompile("([\"\\\\$])") - source = rxp2.ReplaceAll(source, []byte("\\$1")) + source = rxp2.ReplaceAllString(source, "\\$1") rxp := regexp.MustCompile("\\r?\\n") - escaped = rxp.ReplaceAll(source, []byte("\\r\\\r\n \\n")) + escaped = rxp.ReplaceAllString(source, "\\r\\\r\n \\n") return }