Skip to content

Commit eace76e

Browse files
authored
fix: opencode hanging when using client.app.log() during initialization (anomalyco#11642)
1 parent cc1d373 commit eace76e

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

packages/opencode/src/server/server.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,15 @@ export namespace Server {
185185
},
186186
)
187187
.use(async (c, next) => {
188-
let directory = c.req.query("directory") || c.req.header("x-opencode-directory") || process.cwd()
189-
try {
190-
directory = decodeURIComponent(directory)
191-
} catch {
192-
// fallback to original value
193-
}
188+
if (c.req.path === "/log") return next()
189+
const raw = c.req.query("directory") || c.req.header("x-opencode-directory") || process.cwd()
190+
const directory = (() => {
191+
try {
192+
return decodeURIComponent(raw)
193+
} catch {
194+
return raw
195+
}
196+
})()
194197
return Instance.provide({
195198
directory,
196199
init: InstanceBootstrap,

0 commit comments

Comments
 (0)