From d4a000ef0766670b9155df3c8ff89a33ab550b43 Mon Sep 17 00:00:00 2001 From: Logan Cary Date: Tue, 19 Nov 2024 11:31:14 -0500 Subject: [PATCH] NAS-132595 / 25.04 / Handle non-JSON progress messages in TrueCloud Backup (#14974) * handle non-json progress messages * address @themylogin --- .../middlewared/plugins/cloud_backup/restic.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/middlewared/middlewared/plugins/cloud_backup/restic.py b/src/middlewared/middlewared/plugins/cloud_backup/restic.py index bb4158c435dd9..482fb0454b203 100644 --- a/src/middlewared/middlewared/plugins/cloud_backup/restic.py +++ b/src/middlewared/middlewared/plugins/cloud_backup/restic.py @@ -87,7 +87,14 @@ async def restic_check_progress(job, proc, track_progress=False): if read == "": break - read = json.loads(read) + try: + read = json.loads(read) + except json.JSONDecodeError: + # Can happen with some error messages + job.internal_data["messages"] = job.internal_data["messages"][-4:] + [read] + await job.logs_fd_write((read + "\n").encode("utf-8", "ignore")) + continue + msg_type = read["message_type"] match msg_type: case "status":