plugins: reject non-canonical version numbers

If a plugin is installed manually, its version number could be valid but
non-canonical (ex: 1.2.3 vs 01.002.0003).

Since these two versions refer to the same version, but the looks are
different, this may become ambiguous which version should be loaded.

To avoid such a situation, we reject explicitely non-canonical version
numbers in plugins, but only in path, we're aware that because of
metadata, the version from `describe' may already differ from the file
name.
pull/12900/head
Lucas Bajolet 2 years ago committed by Lucas Bajolet
parent 208afbebfa
commit 0e6ee70f6f

@ -187,6 +187,11 @@ func (pr Requirement) ListInstallations(opts ListInstallationsOptions) (InstallL
continue
}
if fmt.Sprintf("v%s", ver.String()) != pluginVersionStr {
log.Printf("version %q in path is non canonical, this could introduce ambiguity and is not supported, ignoring it.", pluginVersionStr)
continue
}
if ver.Prerelease() != "" && opts.ReleasesOnly {
log.Printf("ignoring pre-release plugin %q", path)
continue

Loading…
Cancel
Save