fix(extensions): restore missing owned resources

This commit is contained in:
Julian lechner committed 2026-09-24 17:09:04 +02:00
1 parent 2d88f7d9a0
commit 5bd23bafc3
2 files changed
+3 -2

No files matched your search

+2 -1
View File
@@ -402,6 +402,7 @@ class Manager:
raise ValueError('Invalid MCPorter server definition.')
record = next((r for r in self.state['resources'] if r['client'] == 'shared' and r['name'] == entry['name']), None)
config_path = safe_path(self.home, '.mcporter/mcporter.json')
existing = None
if config_path.exists():
config = json.loads(config_path.read_text(encoding='utf-8'))
if not isinstance(config, dict) or not isinstance(config.get('mcpServers', {}), dict):
@@ -415,7 +416,7 @@ class Manager:
return
if existing is not None and record is not None and existing.get('baseUrl') != record['url']:
raise ValueError('Owned MCPorter server changed locally; refusing to overwrite it.')
if record is not None and not self.update:
if record is not None and existing is not None and not self.update:
return
self.command(['mcporter', '--config', str(self.home / '.mcporter/mcporter.json'), 'config', 'add', server, url])
if record is None: