diff --git a/lollms/internet.py b/lollms/internet.py index 0b564bc..81eed13 100644 --- a/lollms/internet.py +++ b/lollms/internet.py @@ -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) diff --git a/lollms/security.py b/lollms/security.py index 8a482ec..154b1a2 100644 --- a/lollms/security.py +++ b/lollms/security.py @@ -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)