Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

439 B
Raw Blame
use url::Url;

pub(super) fn service_worker_scope_matches_url(scope_url: &Url, candidate_url: &Url) -> bool {
    let scope = scope_url.as_str();
    let candidate = candidate_url.as_str();
    let Some(remainder) = candidate.strip_prefix(scope) else {
        return false;
    };
    if scope.ends_with('/') {
        return true;
    }
    matches!(
        remainder.as_bytes().first(),
        None | Some(b'/' | b'?' | b'#')
    )
}