fix matching of descendants during delete

This commit is contained in:
ducklet 2023-02-11 18:32:36 +01:00
parent 54cdfa4685
commit 19deeb9512

View file

@ -460,11 +460,12 @@ def remove_all(
if hostname is None:
hostname = config.hostname
location_dir = location if location.endswith("/") else location + "/"
selector = and_(
metadex.c.hostname == hostname,
or_(
metadex.c.location == location,
metadex.c.location.startswith(location + "/", autoescape=True),
metadex.c.location.startswith(location_dir, autoescape=True),
),
)
stmt = select(metadex.c.location).where(selector)