add route combination

This commit is contained in:
2025-03-14 12:21:00 +01:00
parent 2f8ffe4feb
commit 65afc249bc
2 changed files with 55 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
from __future__ import annotations
import pickle
import re
import shutil
from collections.abc import Sequence
from pathlib import Path
@@ -95,6 +96,16 @@ def prepare_path(
return (pth_parent / filename).with_suffix(suffix)
def _strip_url_components(string: str) -> str:
return re.sub(r"^[ /]+|[ /]+$", "", string)
def combine_route(base_url: str, route: str) -> str:
base_url = _strip_url_components(base_url)
route = _strip_url_components(route)
return "/".join((base_url, route))
def search_cwd(
glob_pattern: str,
) -> Path | None: