Skip to content

Commit 70b636a

Browse files
committed
zen: normalize ipv6
1 parent a8fd015 commit 70b636a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • packages/console/app/src/routes/zen/util

packages/console/app/src/routes/zen/util/handler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ export async function handler(
9090
const body = await input.request.json()
9191
const model = opts.parseModel(url, body)
9292
const isStream = opts.parseIsStream(url, body)
93-
const ip = input.request.headers.get("x-real-ip") ?? ""
93+
const rawIp = input.request.headers.get("x-real-ip") ?? ""
94+
const ip = rawIp.includes(":") ? rawIp.split(":").slice(0, 4).join(":") : rawIp
9495
const sessionId = input.request.headers.get("x-opencode-session") ?? ""
9596
const requestId = input.request.headers.get("x-opencode-request") ?? ""
9697
const projectId = input.request.headers.get("x-opencode-project") ?? ""

0 commit comments

Comments
 (0)