🐛 fix(utils.py): handle cases where file.filename is not a string or Path object to prevent errors
🔧 chore(utils.py): refactor save_uploaded_file function to improve code readability and maintainability
This commit is contained in:
parent
83351ba639
commit
12a5dd8fde
1 changed files with 5 additions and 1 deletions
6
src/backend/langflow/services/cache/utils.py
vendored
6
src/backend/langflow/services/cache/utils.py
vendored
|
|
@ -169,7 +169,11 @@ def save_uploaded_file(file: UploadFile, folder_name):
|
|||
"""
|
||||
cache_path = Path(CACHE_DIR)
|
||||
folder_path = cache_path / folder_name
|
||||
file_extension = Path(file.filename).suffix
|
||||
filename = file.filename
|
||||
if isinstance(filename, str) or isinstance(filename, Path):
|
||||
file_extension = Path(filename).suffix
|
||||
else:
|
||||
file_extension = ""
|
||||
file_object = file.file
|
||||
|
||||
# Create the folder if it doesn't exist
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue