mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
fix(schedules): accept absolute Windows directories for remote schedules
Remote schedule targets were validated with the host's path.isAbsolute, which rejects Windows paths like C:\Projects\App when the Manager runs on Linux. Share the POSIX/Windows absolute-path check already used by the server terminal routes and use it for remote schedule create and update.
This commit is contained in:
1 parent
eba86dc3fc
commit
742660ecfa
4 files changed
+46
-7
No files matched your search
@@ -9,6 +9,7 @@ import {
|
||||
} from '@opencode-manager/shared/schemas'
|
||||
import { OpenCodeServerError } from '../services/opencode-server-registry'
|
||||
import { TerminalNotFoundError, type TerminalService } from '../services/terminal'
|
||||
import { isAbsoluteRemoteDirectory } from '../utils/remote-path'
|
||||
import { parseTerminalCursor } from '../utils/terminal-cursor'
|
||||
import { createBridgedSocketEvents, isAllowedUpgradeOrigin } from '../utils/websocket-bridge'
|
||||
import { handleOpenCodeError, handleServiceError, parseJsonBody } from '../utils/route-helpers'
|
||||
@@ -23,14 +24,10 @@ interface ServerTerminalSocketVariables {
|
||||
session?: Session['session']
|
||||
}
|
||||
|
||||
function isAbsoluteDirectory(directory: string): boolean {
|
||||
return directory.startsWith('/') || /^[A-Za-z]:[\\/]/.test(directory)
|
||||
}
|
||||
|
||||
function readAbsoluteDirectory(raw: string | undefined): string | null {
|
||||
if (raw === undefined) return null
|
||||
const directory = raw.trim()
|
||||
return directory.length > 0 && isAbsoluteDirectory(directory) ? directory : null
|
||||
return directory.length > 0 && isAbsoluteRemoteDirectory(directory) ? directory : null
|
||||
}
|
||||
|
||||
function rejectLocalServer(c: Context, serverId: string): Response | null {
|
||||
|
||||
Reference in new issue
Block a user