Skip to content

Commit 9023f4d

Browse files
authored
trustpub/gitlab: Accept workflow filepath starting with . (#12267)
The default workflow filepath is `.gitlab-ci.yml` which we previously did not accept anymore since we converted the regex into regular string operations. This fixes the issue.
1 parent 9387835 commit 9023f4d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

crates/crates_io_trustpub/src/gitlab/workflows.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ pub(crate) fn extract_workflow_filepath(workflow_ref: &str) -> Option<&str> {
2323
// Get the basename (part after last slash, or whole string if no slash)
2424
let basename = filepath.rsplit('/').next()?;
2525

26-
// Basename must not start with a dot (rejects ".yml", ".yaml", "somedir/.yaml")
27-
if basename.starts_with('.') {
26+
// Basename must not be empty aside from extension (rejects ".yml", ".yaml", "somedir/.yaml")
27+
if basename == ".yml" || basename == ".yaml" {
2828
return None;
2929
}
3030

@@ -83,6 +83,14 @@ mod tests {
8383
"gitlab.com/foo/bar//a/b.yml@refs/heads/main",
8484
Some("a/b.yml"),
8585
),
86+
(
87+
"gitlab.com/foo/bar//.gitlab-ci.yml@refs/heads/main",
88+
Some(".gitlab-ci.yml"),
89+
),
90+
(
91+
"gitlab.com/foo/bar//.gitlab-ci.yaml@refs/heads/main",
92+
Some(".gitlab-ci.yaml"),
93+
),
8694
// Malformed `ci_config_ref_uri`s.
8795
("gitlab.com/foo/bar//notnested.wrongsuffix@/some/ref", None),
8896
("gitlab.com/foo/bar//@/some/ref", None),

0 commit comments

Comments
 (0)