mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-04-09 03:44:14 +00:00
fix
This commit is contained in:
parent
9d532c2a76
commit
e0689af8a5
@ -135,7 +135,7 @@ def scrape_and_save(url, file_path=None, lollms_com=None, chromedriver_path=None
|
||||
|
||||
|
||||
if file_path:
|
||||
if max_size and text_content< max_size:
|
||||
if max_size and len(text_content)< max_size:
|
||||
# Save the text content as a text file
|
||||
with open(file_path, 'w', encoding="utf-8") as file:
|
||||
file.write(text_content)
|
||||
|
@ -21,7 +21,7 @@ def sanitize_path(path:str, allow_absolute_path:bool=False, error_text="Absolute
|
||||
# Regular expression to detect patterns like "...." and multiple forward slashes
|
||||
suspicious_patterns = re.compile(r'(\.\.+)|(/+/)')
|
||||
|
||||
if suspicious_patterns.search(path) or ((not allow_absolute_path) and Path(path).is_absolute()):
|
||||
if suspicious_patterns.search(str(path)) or ((not allow_absolute_path) and Path(path).is_absolute()):
|
||||
ASCIIColors.error(error_text)
|
||||
raise HTTPException(status_code=400, detail=exception_text)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user