From 0dd8d430b9f74c64470e44352d9ac61c95ddf5cb Mon Sep 17 00:00:00 2001 From: "alexei.dolgolyov" Date: Sat, 23 May 2026 01:13:13 +0300 Subject: [PATCH] fix(devices): preserve existing URL on PATCH-without-url MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a PATCH omits `url` (rename / icon-only edit), normalized_url arrived at the processor as None and the manager kept whatever it had cached — or refused to re-sync if it had nothing. Fall back to existing.url so the processor is always told the current address. Surfaced by the production-review backlog. --- server/src/ledgrab/api/routes/devices.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/server/src/ledgrab/api/routes/devices.py b/server/src/ledgrab/api/routes/devices.py index f704479..af16a6b 100644 --- a/server/src/ledgrab/api/routes/devices.py +++ b/server/src/ledgrab/api/routes/devices.py @@ -640,11 +640,18 @@ async def update_device( icon_color=update_data.icon_color, ) - # Sync connection info in processor manager + # Sync connection info in processor manager. + # + # When a PATCH omits `url` (rename / icon-only edit) `normalized_url` + # is None — fall back to the existing record's URL so the processor + # is always told the current address, otherwise it silently keeps + # whatever it had cached (or worse, treats None as "unconfigured" + # and refuses to re-sync). + effective_url = normalized_url if normalized_url is not None else existing.url try: manager.update_device_info( device_id, - device_url=normalized_url, + device_url=effective_url, led_count=normalized_led_count, baud_rate=update_data.baud_rate, )