fix: resolve symlinks in project directory paths (#1316)
* fix: resolve symlinks in project directory paths OpenCode stores sessions using the canonical (realpath) directory, but OpenChamber passed the unresolved symlink path in several places. The string-match directory filter would fail when a project was accessed via a symlink, making sessions invisible. Changes: - Add safeRealpathSync to settings normalization — project paths and lastDirectory are canonicalized at persistence time - Add Express middleware before the API proxy to resolve symlinks in ?directory= query params on in-flight requests - Resolve symlinks in /api/fs/list so the directory browser returns canonical paths, allowing the "already added" check to work correctly - Reconcile the in-memory projects store when the server responds with normalized paths, preventing temporary duplicates Fixes #1315 * fix: avoid sync realpath in opencode proxy --------- Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
committed by
GitHub
co-authored by
Bohdan Triapitsyn
parent
90b3d4760e
commit
c5862cc6ee
@@ -119,6 +119,13 @@ const persistToLocalStorage = (settings: DesktopSettings) => {
|
||||
}
|
||||
};
|
||||
|
||||
const dispatchSettingsSynced = (settings: DesktopSettings): void => {
|
||||
if (typeof window === 'undefined') {
|
||||
return;
|
||||
}
|
||||
window.dispatchEvent(new CustomEvent<DesktopSettings>('openchamber:settings-synced', { detail: settings }));
|
||||
};
|
||||
|
||||
type PersistApi = {
|
||||
hasHydrated?: () => boolean;
|
||||
onFinishHydration?: (callback: () => void) => (() => void) | undefined;
|
||||
@@ -1165,9 +1172,7 @@ export const syncDesktopSettings = async (): Promise<void> => {
|
||||
console.warn('applyDesktopUiPreferences failed:', error);
|
||||
}
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
window.dispatchEvent(new CustomEvent<DesktopSettings>('openchamber:settings-synced', { detail: settings }));
|
||||
}
|
||||
dispatchSettingsSynced(settings);
|
||||
};
|
||||
|
||||
try {
|
||||
@@ -1198,6 +1203,7 @@ const _flushSettingsUpdate = async (): Promise<void> => {
|
||||
if (updated) {
|
||||
persistToLocalStorage(updated);
|
||||
applyDesktopUiPreferences(updated);
|
||||
dispatchSettingsSynced(updated);
|
||||
}
|
||||
return;
|
||||
} catch (error) {
|
||||
@@ -1224,6 +1230,7 @@ const _flushSettingsUpdate = async (): Promise<void> => {
|
||||
if (updated) {
|
||||
persistToLocalStorage(updated);
|
||||
applyDesktopUiPreferences(updated);
|
||||
dispatchSettingsSynced(updated);
|
||||
// Invalidate GET cache so next read sees the fresh data
|
||||
_settingsCache = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user