This commit is contained in:
Saifeddine ALOUI 2024-03-31 03:01:20 +02:00
parent 9d532c2a76
commit e0689af8a5
2 changed files with 2 additions and 2 deletions

View File

@ -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)

View File

@ -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)