Skip to content

config: Don't panic on plugin JSON files without a plugin entry - #4247

Merged
dmaluka merged 1 commit into
micro-editor:masterfrom
4RH1T3CT0R7:fix/plugin-json-name
Sep 28, 2026
Merged

dmaluka merged 1 commit into
micro-editor:masterfrom
4RH1T3CT0R7:fix/plugin-json-name

Conversation

@4RH1T3CT0R7

Copy link
Copy Markdown
Contributor

if a .json file in a plugin directory contains [] or null, NewPluginInfo (internal/config/plugin_manager.go) indexes info[0] on an empty slice. the panic happens in InitPlugins(), before the recover() in main(), so the deferred exit(0) quits micro on every start with status 0 and no message. a file whose first entry has no Name doesn't crash, but it blanks the plugin name and the plugin is dropped

NewPluginInfo now returns the existing ErrMissingName for both. the callers already skip files that fail to parse, so the plugin keeps its directory name. the new TestNewPluginInfoRejectsMissingName panicked before the change and passes now

A .json file in a plugin directory that decodes to an empty list (`[]`
or `null`) made NewPluginInfo index info[0] on an empty slice. The panic
happens in InitPlugins(), before the recover() in main(), and the
deferred exit(0) ends micro silently with status 0 on every start.

A file whose first entry has no Name did not crash, but it replaced the
plugin name with an empty string, so the plugin was dropped as "not a
plugin".

Return the existing ErrMissingName in both cases. InitPlugins() already
skips files that fail to parse, so the plugin keeps its directory name.
@dmaluka
dmaluka merged commit 50a6fe5 into micro-editor:master Sep 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants