From 96bce3da81217803d56e347e7fbf24f4923b996a Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 21 Jun 2023 17:45:12 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(utils.py):=20remove=20file?= =?UTF-8?q?=20extension=20from=20saved=20file=20name=20=F0=9F=90=9B=20fix(?= =?UTF-8?q?process.py):=20correctly=20update=20template=5Fdata=20with=20tw?= =?UTF-8?q?eak=5Fvalue=20The=20file=20extension=20is=20no=20longer=20inclu?= =?UTF-8?q?ded=20in=20the=20saved=20file=20name=20to=20avoid=20issues=20wi?= =?UTF-8?q?th=20file=20extensions=20that=20may=20not=20be=20supported.=20I?= =?UTF-8?q?n=20process.py,=20the=20tweak=5Fvalue=20is=20now=20correctly=20?= =?UTF-8?q?updated=20in=20the=20template=5Fdata=20dictionary.=20The=20key?= =?UTF-8?q?=20is=20now=20set=20to=20"value"=20for=20all=20tweaks=20except?= =?UTF-8?q?=20for=20"file=5Fpath"=20where=20the=20key=20is=20set=20to=20th?= =?UTF-8?q?e=20name=20of=20the=20tweak.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/cache/utils.py | 3 +-- src/backend/langflow/processing/process.py | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/langflow/cache/utils.py b/src/backend/langflow/cache/utils.py index 3e456c3d4..3deabe9f4 100644 --- a/src/backend/langflow/cache/utils.py +++ b/src/backend/langflow/cache/utils.py @@ -165,8 +165,7 @@ def save_uploaded_file(file, folder_name): # Use the hex digest of the hash as the file name hex_dig = sha256_hash.hexdigest() - file_extension = Path(file.filename).suffix - file_name = f"{hex_dig}{file_extension}" + file_name = hex_dig # Reset the file cursor to the beginning of the file file.seek(0) diff --git a/src/backend/langflow/processing/process.py b/src/backend/langflow/processing/process.py index 4f5295c60..f817a210a 100644 --- a/src/backend/langflow/processing/process.py +++ b/src/backend/langflow/processing/process.py @@ -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(): 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(