From 9d3a2867966e251eac5b9e37dcfcfa01d7001811 Mon Sep 17 00:00:00 2001 From: guest20 Date: Tue, 4 Aug 2026 14:46:01 +0200 Subject: [PATCH] robots.py: list_to_pcre don't overwrite patterns --- code/robots.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/robots.py b/code/robots.py index 1652024..e63d2bd 100755 --- a/code/robots.py +++ b/code/robots.py @@ -191,15 +191,16 @@ def list_to_pcre(robots_json): for agent, config in robots_json.items() if config.get("sends_full_name", False) ) - patterns = [f"^({exact_agents})$"] + patterns.extend( f"^({exact_agents})$" ) # agents who use Name/1.1.3-style elements - patterns.extend( + versioned_agents = "|".join( f"{re.escape(agent)}/[0-9.]+" for agent, config in robots_json.items() if config.get("has_name_and_version", False) ) - + patterns.extend( versioned_agents ) + return f"({'|'.join(patterns)})"