AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
Rework local file address blocks
onekumb60c7518b064
diff --git a/scripts/browse.py b/scripts/browse.pyindex 4a73d92320..09f376a70a 100644--- a/scripts/browse.py+++ b/scripts/browse.py@@ -5,6 +5,11 @@ from llm_utils import create_chat_completioncfg = Config()+# Define and check for local file address prefixes+def check_local_file_access(url):+ local_prefixes = ['file:///', 'file://localhost', 'http://localhost', 'https://localhost']+ return any(url.startswith(prefix) for prefix in local_prefixes)+def scrape_text(url):"""Scrape text from a webpage"""# Most basic check if the URL is valid:@@ -12,7 +17,7 @@ def scrape_text(url):return "Error: Invalid URL"# Restrict access to local files- if url.startswith('file://') or url.startswith('file://localhost'):+ if check_local_file_access(url):return "Error: Access to local files is restricted"try: