mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 14:34:23 +01:00
Restrict browse from accessing local files
This commit is contained in:
@@ -11,6 +11,10 @@ def scrape_text(url):
|
|||||||
if not url.startswith('http'):
|
if not url.startswith('http'):
|
||||||
return "Error: Invalid URL"
|
return "Error: Invalid URL"
|
||||||
|
|
||||||
|
# Restrict access to local files
|
||||||
|
if url.startswith('file://') or url.startswith('file://localhost'):
|
||||||
|
return "Error: Access to local files is restricted"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=cfg.user_agent_header)
|
response = requests.get(url, headers=cfg.user_agent_header)
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
@@ -126,4 +130,4 @@ def summarize_text(text, question):
|
|||||||
max_tokens=300,
|
max_tokens=300,
|
||||||
)
|
)
|
||||||
|
|
||||||
return final_summary
|
return final_summary
|
||||||
|
|||||||
Reference in New Issue
Block a user