fix(security): scope managed path opening
This commit is contained in:
1 parent
bde35c3518
commit
66e24b1060
9 files changed
+66
-30
No files matched your search
@@ -135,7 +135,12 @@ export function useCompanyController() {
|
||||
|
||||
const openPathWithFeedback = useCallback(async (path: string) => {
|
||||
const store = useAppStore.getState();
|
||||
try { unwrap(await window.agentCompany.openPath(path)); store.setError(null); }
|
||||
const companyId = store.snapshot?.currentCompanyId;
|
||||
if (!companyId) {
|
||||
store.setError("Select a company before opening a managed path.");
|
||||
return;
|
||||
}
|
||||
try { unwrap(await window.agentCompany.openPath({ companyId, path })); store.setError(null); }
|
||||
catch (err) { store.setError(describeDesktopError(err)); }
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -159,12 +159,7 @@ export function OperationsSections({ section }: OperationsSectionsProps) {
|
||||
}
|
||||
}}
|
||||
onOpenPath={async (path) => {
|
||||
try {
|
||||
unwrap(await window.agentCompany.openPath(path));
|
||||
setError(null);
|
||||
} catch (error) {
|
||||
setError(describeDesktopError(error));
|
||||
}
|
||||
await openPathWithFeedback(path);
|
||||
}}
|
||||
onCancelAction={async (actionId) => {
|
||||
if (!snapshot?.currentCompanyId) return;
|
||||
|
||||
Reference in new issue
Block a user