Fix File Manager rename not updating displayed name (#460)

The rename endpoint updated `filename` but not `file_metadata.print_name`,
which the UI uses as the primary display name. Since print_name is extracted
from the 3MF at upload, it always took precedence over the renamed filename.

Now also updates print_name in file metadata when present.
This commit is contained in:
maziggy
2026-02-21 16:48:42 +01:00
parent 257b4748e5
commit 7584a2455c
2 changed files with 4 additions and 0 deletions
+1
View File
@@ -6,6 +6,7 @@ All notable changes to Bambuddy will be documented in this file.
### Fixed
- **Developer Mode Detection Always Reports Null** — The MQTT `fun` field is an integer in the JSON payload, but the parser used `int(value, 16)` which requires a string argument. This raised `TypeError` on every message, silently caught by the exception handler, so `developer_mode` was never set. Now handles both integer and hex string formats.
- **File Manager Rename Doesn't Update Displayed Name** ([#460](https://github.com/maziggy/bambuddy/issues/460)) — Renaming a file in the File Manager updated the `filename` field but not `file_metadata.print_name`, which the UI uses as the primary display name. Since `print_name` is extracted from inside the 3MF at upload time, it always took precedence over the renamed `filename`. The rename endpoint now also updates `print_name` in the file metadata when present.
## [0.2.1b2] - 2026-02-21
+3
View File
@@ -1935,6 +1935,9 @@ async def update_file(
if "/" in data.filename or "\\" in data.filename:
raise HTTPException(status_code=400, detail="Filename cannot contain path separators")
file.filename = data.filename
# Also update print_name in file_metadata so the display name matches
if file.file_metadata and "print_name" in file.file_metadata:
file.file_metadata = {**file.file_metadata, "print_name": data.filename}
if data.folder_id is not None:
if data.folder_id == 0: