🐛 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:
Gabriel Luiz Freitas Almeida 2023-06-21 17:45:12 -03:00
commit 96bce3da81
2 changed files with 3 additions and 3 deletions

View file

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

View file

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