Repository navigation
fix(plugin): keep candidate plugin name when installing from a directory - #608
Open
amdadulbari wants to merge 1 commit into
Open
amdadulbari wants to merge 1 commit into
amdadulbari wants to merge 1 commit into
Conversation
When a plugin directory contains no executable file but exactly one file
named notation-{plugin-name}, Install sets the executable bit on that
candidate and installs it. parsePluginFromDir stored the result of
parsePluginName directly in candidatePluginName for every regular file,
so any file visited after the candidate whose name does not follow the
notation-{plugin-name} format reset it to an empty string.
As a result, installing from a directory such as
notation-foo (not executable)
readme.md
failed with the misleading error
failed to get metadata of new plugin: plugin executable file name
must be "notation-foo" instead of "notation-foo"
while the same directory installs fine if the extra file sorts before
the candidate (e.g. LICENSE or libfoo).
Only update candidatePluginName when the file name is a valid plugin
executable file name.
Signed-off-by: Md. Amdadul Bari Imad <amdadulbari@gmail.com>
amdadulbari
requested review from
NiazFK,
gokarnm,
priteshbandi,
rgnote,
shizhMSFT,
toddysm,
vaninrao10 and
yizha1
as code owners
December 4, 2026 09:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #607
parsePluginFromDirassigned the result ofparsePluginNamestraight tocandidatePluginNamefor every regular file.parsePluginNamereturns an empty name for a file that does not follow thenotation-{plugin-name}format, so any such file visited after the candidate (the walk is in lexical order) reset the candidate name to"".Installing from a directory like
then failed with
while the same directory installs fine when the extra file sorts before the candidate (
LICENSE,libfoo).The candidate name is now only updated when the file name is a valid plugin executable file name.
Testing
Added a
TestManager_Installcase with a non-executablenotation-foofollowed byreadme.md. It fails without the change with the error above and passes with it.go test ./...andgo vet ./plugin/...pass locally (Linux, Go 1.27).