The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): bridge WSL paths for the remaining file-read handlers
null-runner2df349060a31
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.tsindex 458fb226f23..276de1683d8 100644--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@ -600,7 +600,7 @@ import { installWindowsSystemCaTrust } from './windows-system-ca'import { readWindowsUserEnvVar } from './windows-user-env'import { isPackagedInstallPath as isPackagedInstallPathUnderRoots } from './workspace-cwd'import { readWslWindowsClipboardImage } from './wsl-clipboard-image'-import { resolvePickerDefaultPath, setActiveGatewayProfile, setWslBridgeProfileState } from './wsl-path-bridge'+import { resolveLocalReadPath, resolvePickerDefaultPath, setActiveGatewayProfile, setWslBridgeProfileState } from './wsl-path-bridge'const IDENTITY_APP_NAME: string | null = applyDesktopIdentity(app)const USER_DATA_OVERRIDE: string | undefined = process.env.HERMES_DESKTOP_USER_DATA_DIR@@ -1515,7 +1515,12 @@ function registerMediaProtocol(): void {})},resolveLocalFile: async filePath => {- const { resolvedPath } = await resolveReadableFileForIpc(filePath, { purpose: 'Media stream' })+ // On a Windows host with a WSL backend the media path arrives as a+ // WSL/POSIX path (`/home/...`, `/mnt/c/...`) the Windows fs can't open+ // as-is; bridge it to a UNC/drive form first, same as directory reads.+ const { resolvedPath } = await resolveReadableFileForIpc(resolveLocalReadPath(filePath), {+ purpose: 'Media stream'+ })return resolvedPath},@@ -5950,7 +5955,10 @@ async function previewFileTarget(rawTarget, baseDir) {const raw = String(rawTarget || '').trim()const base = baseDir ? path.resolve(expandUserPath(baseDir)) : resolveHermesCwd()- let resolved = resolveRequestedPathForIpc(/^file:/i.test(raw) ? raw : expandUserPath(raw), {+ // A plain backend target is a WSL/POSIX path; bridge it to a Windows-+ // accessible form before resolving so the existence checks below (and the+ // final read) hit the real file rather than a drive-relative C:\home\... miss.+ let resolved = resolveRequestedPathForIpc(resolveLocalReadPath(/^file:/i.test(raw) ? raw : expandUserPath(raw)), {baseDir: base,purpose: 'Preview target'})@@ -17107,9 +17115,13 @@ ipcMain.handle('hermes:data-url-read-max:set', (_event, maxMb) => {})ipcMain.handle('hermes:readFileDataUrl', async (_event, filePath) => {- return readFileDataUrlForIpc(filePath, {+ // Backend-reported paths are WSL/POSIX (`/home/...`, `/mnt/c/...`); on a+ // Windows host bridge them to a UNC/drive form, same as directory reads.+ const bridgedPath = resolveLocalReadPath(String(filePath ?? ''))++ return readFileDataUrlForIpc(bridgedPath, {maxBytes: dataUrlReadMaxBytesFromMb(dataUrlReadMaxMb),- mimeType: mimeTypeForPath(resolveRequestedPathForIpc(filePath, { purpose: 'File preview' })),+ mimeType: mimeTypeForPath(resolveRequestedPathForIpc(bridgedPath, { purpose: 'File preview' })),purpose: 'File preview'})})@@ -17127,7 +17139,7 @@ ipcMain.handle('hermes:readFileDataUrlForAttach', async (_event, filePath) => {})ipcMain.handle('hermes:readFileText', async (_event, filePath) => {- const { resolvedPath, stat } = await resolveReadableFileForIpc(filePath, {+ const { resolvedPath, stat } = await resolveReadableFileForIpc(resolveLocalReadPath(String(filePath ?? '')), {maxBytes: TEXT_PREVIEW_SOURCE_MAX_BYTES,purpose: 'Text preview'})