Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
ensure the patterns are prepended with the base
This is to ensure that matching files is correct.
  • Loading branch information
RobinMalfait authored and thecrypticace committed Oct 28, 2024
commit d0efb45d33a523401cc444e83e6f32bf77a29855
10 changes: 9 additions & 1 deletion crates/oxide/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,15 @@ impl Scanner {
let hoisted = hoist_static_glob_parts(&glob_sources);

for source in &hoisted {
let Ok(glob) = Glob::new(&source.base) else {
// We need to combine the base and the pattern, otherwise a pattern that looks like
// `*.html`, will never match a path that looks like
// `/my-project/project-a/index.html`, because it contains `/`.
//
// We can't prepend `**/`, because then `/my-project/project-a/nested/index.html` would
// match as well.
//
// Instead we combine the base and the pattern as a single glob pattern.
let Ok(glob) = Glob::new(&format!("{}/{}", source.base, source.pattern)) else {
continue;
};

Expand Down