(first: &str, second: &str)
| 774 | } |
| 775 | |
| 776 | fn path_patterns_can_overlap(first: &str, second: &str) -> bool { |
| 777 | if path_matches_all(first) || path_matches_all(second) { |
| 778 | return true; |
| 779 | } |
| 780 | if !first.contains('*') { |
| 781 | return endpoint_path_matches(second, first); |
| 782 | } |
| 783 | if !second.contains('*') { |
| 784 | return endpoint_path_matches(first, second); |
| 785 | } |
| 786 | match (path_prefix_pattern(first), path_prefix_pattern(second)) { |
| 787 | (Some(first_prefix), Some(second_prefix)) => { |
| 788 | first_prefix == second_prefix |
| 789 | || first_prefix.starts_with(&format!("{second_prefix}/")) |
| 790 | || second_prefix.starts_with(&format!("{first_prefix}/")) |
| 791 | } |
| 792 | _ => true, |
| 793 | } |
| 794 | } |
| 795 | |
| 796 | fn path_matches_all(path: &str) -> bool { |
| 797 | path.is_empty() || path == "**" || path == "/**" |
no test coverage detected