From 7584a2455c2d573b6b032cee21fee36dd0f133b5 Mon Sep 17 00:00:00 2001 From: maziggy Date: Sat, 21 Feb 2026 16:48:42 +0100 Subject: [PATCH] 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. --- CHANGELOG.md | 1 + backend/app/api/routes/library.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb148aac7..743e5f68e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/backend/app/api/routes/library.py b/backend/app/api/routes/library.py index e9a7a3dbf..79009f93d 100644 --- a/backend/app/api/routes/library.py +++ b/backend/app/api/routes/library.py @@ -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: