Skip to content

Commit e9a60de

Browse files
Fix repository URL regex
1 parent 3ce7ae6 commit e9a60de

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/repositories/updater.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ impl RepositoryStatsUpdater {
273273

274274
pub(crate) fn repository_name(url: &str) -> Option<RepositoryName> {
275275
static RE: Lazy<Regex> = Lazy::new(|| {
276-
Regex::new(r"https?://(?P<host>.+)/(?P<owner>[\w\._-]+)/(?P<repo>[\w\._-]+)").unwrap()
276+
Regex::new(r"https?://(?P<host>[^/]+)/(?P<owner>[\w\._/-]+)/(?P<repo>[\w\._-]+)").unwrap()
277277
});
278278

279279
let cap = RE.captures(url)?;
@@ -328,6 +328,9 @@ mod test {
328328
assert_name!("https://gitlab.freedesktop.org/test/test" => (
329329
"test", "test", "gitlab.freedesktop.org"
330330
));
331+
assert_name!("https://gitlab.com/artgam3s/public-libraries/rust/rpa" => (
332+
"artgam3s/public-libraries/rust", "rpa", "gitlab.com"
333+
));
331334

332335
// github checks
333336
assert_name!("https://github.com/onur/cratesfyi" => ("onur", "cratesfyi", "github.com"));

0 commit comments

Comments
 (0)