From edcbecca015db0014ad79e3955e18163e5200e89 Mon Sep 17 00:00:00 2001 From: bbhtt Date: Sun, 23 Feb 2025 14:31:28 +0530 Subject: [PATCH] publish: Overwrite bugtracker URL if unverified --- src/cmd_publish.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/cmd_publish.rs b/src/cmd_publish.rs index e3496f9..25931a0 100644 --- a/src/cmd_publish.rs +++ b/src/cmd_publish.rs @@ -350,6 +350,18 @@ pub fn rewrite_appstream_xml( } } + let app_id = refstring.split('/').nth(1).unwrap_or("flathub"); + + if !storefront_info + .verification + .as_ref() + .is_some_and(|v| v.verified) + { + let bugtracker_url = find_or_create_element(component, "url", Some(("type", "bugtracker"))); + bugtracker_url.set_text(format!("https://github.com/flathub/{}/issues", app_id)); + changed = true; + } + if changed { Ok(root.to_string()?) } else { @@ -457,6 +469,7 @@ mod tests { org.flatpak.Test + https://flatpak.org/issues "#; @@ -492,6 +505,7 @@ mod tests { r#" org.flatpak.Test + https://flatpak.org/issues true 2023-01-01T00:00:00 @@ -511,6 +525,7 @@ mod tests { org.flatpak.Test + https://example.com/issues "#; @@ -552,6 +567,7 @@ mod tests { r#" org.flatpak.Test + https://github.com/flathub/org.flatpak.Test/issues 1 https://example.com @@ -606,6 +622,7 @@ mod tests { 2 + https://github.com/flathub/org.flatpak.Test/issues "#, )