mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 13:05:46 +00:00
59848fe14b
Fixes #12097 Signed-off-by: Percy Wegmann <percy@tailscale.com>
17 lines
324 B
Go
17 lines
324 B
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
package shared
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/xml"
|
|
)
|
|
|
|
// EscapeForXML escapes the given string for use in XML text.
|
|
func EscapeForXML(s string) string {
|
|
result := bytes.NewBuffer(nil)
|
|
xml.Escape(result, []byte(s))
|
|
return result.String()
|
|
}
|