diff --git a/src/main/scala/gitbucket/core/plugin/PluginRegistry.scala b/src/main/scala/gitbucket/core/plugin/PluginRegistry.scala index 62acace..fb0d39e 100644 --- a/src/main/scala/gitbucket/core/plugin/PluginRegistry.scala +++ b/src/main/scala/gitbucket/core/plugin/PluginRegistry.scala @@ -272,17 +272,23 @@ lazy val extraPluginDir: Option[String] = Option(System.getProperty("gitbucket.pluginDir")) def getGitBucketVersion(pluginJarFileName: String): Option[String] = { - val regex = ".+-gitbucket\\_(\\d+\\.\\d+\\.\\d+)-.+".r + val regex = ".+-gitbucket\\_(\\d+\\.\\d+\\.\\d+(-SNAPSHOT)?)-.+".r pluginJarFileName match { - case regex(x) => Some(x) - case _ => None + case regex(all, _) => Some(all) + case _ => None } } def getPluginVersion(pluginJarFileName: String): String = { - val regex = ".+-(\\d+\\.\\d+\\.\\d+)\\.jar$".r + val regex = ".+-((\\d+)\\.(\\d+)(\\.(\\d+))?(-SNAPSHOT)?)\\.jar$".r pluginJarFileName match { - case regex(x) => x + case regex(all, major, minor, _, patch, modifier) => { + if (patch != null) all + else { + s"${major}.${minor}.0" + (if (modifier == null) "" else modifier) + } + } + case _ => "0.0.0" } }