From c839244d8d09f3036ebfee8eef7eb6b147e593ab Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 19 May 2026 00:10:22 +0900 Subject: fix(compile): fix various compile errors Co-Authored-By: Claude Sonnet 4.6 --- crates/shirabe/src/util/forgejo_url.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'crates/shirabe/src/util/forgejo_url.rs') diff --git a/crates/shirabe/src/util/forgejo_url.rs b/crates/shirabe/src/util/forgejo_url.rs index 3b42f13..5fdaab7 100644 --- a/crates/shirabe/src/util/forgejo_url.rs +++ b/crates/shirabe/src/util/forgejo_url.rs @@ -4,6 +4,7 @@ use anyhow::Result; use shirabe_external_packages::composer::pcre::preg::Preg; use shirabe_php_shim::InvalidArgumentException; +#[derive(Debug)] pub struct ForgejoUrl { pub owner: String, pub repository: String, @@ -37,7 +38,22 @@ impl ForgejoUrl { pub fn try_from(repo_url: Option<&str>) -> Option { let repo_url = repo_url?; - let m = Preg::match_(Self::URL_REGEX, repo_url)?; + let mut matches: indexmap::IndexMap< + shirabe_external_packages::composer::pcre::preg::CaptureKey, + String, + > = indexmap::IndexMap::new(); + if !Preg::match3(Self::URL_REGEX, repo_url, Some(&mut matches)).unwrap_or(false) { + return None; + } + use shirabe_external_packages::composer::pcre::preg::CaptureKey; + let m: Vec = (0..5) + .map(|i| { + matches + .get(&CaptureKey::ByIndex(i)) + .cloned() + .unwrap_or_default() + }) + .collect(); let origin_url = if !m[1].is_empty() { m[1].clone() -- cgit v1.3.1