Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions crates/crates_io_trustpub/src/gitlab/workflows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ pub(crate) fn extract_workflow_filepath(workflow_ref: &str) -> Option<&str> {
// Get the basename (part after last slash, or whole string if no slash)
let basename = filepath.rsplit('/').next()?;

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

Expand Down Expand Up @@ -83,6 +83,14 @@ mod tests {
"gitlab.com/foo/bar//a/b.yml@refs/heads/main",
Some("a/b.yml"),
),
(
"gitlab.com/foo/bar//.gitlab-ci.yml@refs/heads/main",
Some(".gitlab-ci.yml"),
),
(
"gitlab.com/foo/bar//.gitlab-ci.yaml@refs/heads/main",
Some(".gitlab-ci.yaml"),
),
// Malformed `ci_config_ref_uri`s.
("gitlab.com/foo/bar//notnested.wrongsuffix@/some/ref", None),
("gitlab.com/foo/bar//@/some/ref", None),
Expand Down