From a3d48f2d2b8bf1ccd38c192eafc0941cc6219210 Mon Sep 17 00:00:00 2001 From: SIMULATAN Date: Wed, 6 Nov 2024 09:29:41 +0100 Subject: [PATCH 1/3] fix: repoURL matching is case sensitive --- src/parsing.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parsing.rs b/src/parsing.rs index 4f12b66..4694462 100644 --- a/src/parsing.rs +++ b/src/parsing.rs @@ -235,7 +235,7 @@ async fn patch_applications( return; } match spec["source"]["repoURL"].as_str() { - Some(url) if url.contains(repo) => { + Some(url) if url.to_lowercase().contains(repo.to_lowercase()) => { spec["source"]["targetRevision"] = serde_yaml::Value::String(branch.to_string()) } _ => debug!("Found no 'repoURL' under spec.sources[] in file: {}", file), @@ -247,7 +247,7 @@ async fn patch_applications( continue; } match source["repoURL"].as_str() { - Some(url) if url.contains(repo) => { + Some(url) if url.to_lowercase().contains(repo.to_lowercase()) => { source["targetRevision"] = serde_yaml::Value::String(branch.to_string()); } From 57e577139c4ff29a263649dac7d74c64bf906887 Mon Sep 17 00:00:00 2001 From: SIMULATAN Date: Wed, 6 Nov 2024 09:30:59 +0100 Subject: [PATCH 2/3] fix: `source` debug message using `sources` --- src/parsing.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parsing.rs b/src/parsing.rs index 4694462..ee772aa 100644 --- a/src/parsing.rs +++ b/src/parsing.rs @@ -238,7 +238,7 @@ async fn patch_applications( Some(url) if url.to_lowercase().contains(repo.to_lowercase()) => { spec["source"]["targetRevision"] = serde_yaml::Value::String(branch.to_string()) } - _ => debug!("Found no 'repoURL' under spec.sources[] in file: {}", file), + _ => debug!("Found no 'repoURL' under spec.source in file: {}", file), } } else if spec.contains_key("sources") { if let Some(sources) = spec["sources"].as_sequence_mut() { From cb847e732ea67d14bcee63cefadf8aba65371632 Mon Sep 17 00:00:00 2001 From: Jakob Hofer Date: Wed, 6 Nov 2024 17:47:51 +0100 Subject: [PATCH 3/3] fixup! fix: repoURL matching is case sensitive Co-authored-by: Dag Andersen --- src/parsing.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parsing.rs b/src/parsing.rs index ee772aa..c209582 100644 --- a/src/parsing.rs +++ b/src/parsing.rs @@ -235,7 +235,7 @@ async fn patch_applications( return; } match spec["source"]["repoURL"].as_str() { - Some(url) if url.to_lowercase().contains(repo.to_lowercase()) => { + Some(url) if url.to_lowercase().contains(&repo.to_lowercase()) => { spec["source"]["targetRevision"] = serde_yaml::Value::String(branch.to_string()) } _ => debug!("Found no 'repoURL' under spec.source in file: {}", file), @@ -247,7 +247,7 @@ async fn patch_applications( continue; } match source["repoURL"].as_str() { - Some(url) if url.to_lowercase().contains(repo.to_lowercase()) => { + Some(url) if url.to_lowercase().contains(&repo.to_lowercase()) => { source["targetRevision"] = serde_yaml::Value::String(branch.to_string()); }