🐛 fix(utils.py): remove file extension from saved file name
🐛 fix(process.py): correctly update template_data with tweak_value
The file extension is no longer included in the saved file name to avoid issues with file extensions that may not be supported. In process.py, the tweak_value is now correctly updated in the template_data dictionary. The key is now set to "value" for all tweaks except for "file_path" where the key is set to the name of the tweak.
This commit is contained in:
parent
3781f1ddda
commit
96bce3da81
2 changed files with 3 additions and 3 deletions
3
src/backend/langflow/cache/utils.py
vendored
3
src/backend/langflow/cache/utils.py
vendored
|
|
@ -165,8 +165,7 @@ def save_uploaded_file(file, folder_name):
|
||||||
|
|
||||||
# Use the hex digest of the hash as the file name
|
# Use the hex digest of the hash as the file name
|
||||||
hex_dig = sha256_hash.hexdigest()
|
hex_dig = sha256_hash.hexdigest()
|
||||||
file_extension = Path(file.filename).suffix
|
file_name = hex_dig
|
||||||
file_name = f"{hex_dig}{file_extension}"
|
|
||||||
|
|
||||||
# Reset the file cursor to the beginning of the file
|
# Reset the file cursor to the beginning of the file
|
||||||
file.seek(0)
|
file.seek(0)
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,8 @@ def apply_tweaks(node: Dict[str, Any], node_tweaks: Dict[str, Any]) -> None:
|
||||||
|
|
||||||
for tweak_name, tweak_value in node_tweaks.items():
|
for tweak_name, tweak_value in node_tweaks.items():
|
||||||
if tweak_name and tweak_value and tweak_name in template_data:
|
if tweak_name and tweak_value and tweak_name in template_data:
|
||||||
template_data[tweak_name]["value"] = tweak_value
|
key = tweak_name if tweak_name == "file_path" else "value"
|
||||||
|
template_data[tweak_name][key] = tweak_value
|
||||||
|
|
||||||
|
|
||||||
def process_tweaks(
|
def process_tweaks(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue