chore(opencode): consolidate escape logic (#32360)

This commit is contained in:
Aiden Cline
2026-06-14 20:27:02 -05:00
committed by GitHub
parent a9a4b2f00f
commit a774c62eac
7 changed files with 44 additions and 51 deletions
+1 -9
View File
@@ -1,5 +1,6 @@
import { createConnection } from "net"
import { createServer } from "http"
import { escapeHtml } from "@/util/html"
import { OAUTH_CALLBACK_PORT, OAUTH_CALLBACK_PATH, parseRedirectUri } from "./oauth-provider"
// Current callback server configuration (may differ from defaults if custom redirectUri is used)
@@ -26,15 +27,6 @@ const HTML_SUCCESS = `<!DOCTYPE html>
</body>
</html>`
function escapeHtml(value: string) {
return value
.replaceAll("&", "&amp;")
.replaceAll("<", "&lt;")
.replaceAll(">", "&gt;")
.replaceAll('"', "&quot;")
.replaceAll("'", "&#39;")
}
const HTML_ERROR = (error: string) => `<!DOCTYPE html>
<html>
<head>