improve version detection from source

This commit is contained in:
Ruben Fiszel
2025-02-17 11:49:06 +01:00
parent 88c03c77bb
commit 06f1f10b40
2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -47,8 +47,11 @@ lazy_static::lazy_static! {
.connect_timeout(std::time::Duration::from_secs(10))
.build().unwrap();
pub static ref GIT_SEM_VERSION: Version = Version::parse(
// skip first `v` character.
GIT_VERSION.split_at(1).1
if GIT_VERSION.starts_with('v') {
&GIT_VERSION[1..]
} else {
GIT_VERSION
}
).unwrap_or(Version::new(0, 1, 0));
}
+1 -1
View File
@@ -657,7 +657,7 @@ pub async fn update_min_version<'c, E: sqlx::Executor<'c, Database = sqlx::Postg
let min_version = pings
.iter()
.filter(|x| !x.is_empty())
.filter_map(|x| semver::Version::parse(x.split_at(1).1).ok())
.filter_map(|x| semver::Version::parse(if x.starts_with('v') { &x[1..] } else { x }).ok())
.min()
.unwrap_or_else(|| cur_version.clone());