(version string)
| 102 | } |
| 103 | |
| 104 | func ValidatePluginVersion(version string) error { |
| 105 | if !strings.Contains(version, "v") { |
| 106 | version = fmt.Sprintf("v%s", version) |
| 107 | } |
| 108 | // semantic versioning validation on plugin's version |
| 109 | if !semver.IsValid(version) { |
| 110 | return util.NewApiError(http.StatusBadRequest, bean2.PluginVersionNotSemanticallyCorrectError, bean2.PluginVersionNotSemanticallyCorrectError) |
| 111 | } |
| 112 | return nil |
| 113 | } |
| 114 | |
| 115 | // StripVersionSuffixFromName removes version suffix patterns like "v1.0.0", "v1.0", "v1" from the end of plugin names. |
| 116 | // This is used during migration to ensure plugins with names like "DockerSlim v1.0.0" and "DockerSlim" |
no test coverage detected
searching dependent graphs…