From 4f0ac1eb37c8874d71f711a6b84d9ea3b6e03098 Mon Sep 17 00:00:00 2001 From: Egbert Bouman Date: Fri, 13 Dec 2024 15:43:18 +0100 Subject: [PATCH 1/2] Fix updating guiSettings --- src/tribler/ui/src/services/tribler.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tribler/ui/src/services/tribler.service.ts b/src/tribler/ui/src/services/tribler.service.ts index 3daa951e9b..5e056554ed 100644 --- a/src/tribler/ui/src/services/tribler.service.ts +++ b/src/tribler/ui/src/services/tribler.service.ts @@ -294,7 +294,7 @@ export class TriblerService { async setSettings(settings: Partial): Promise { try { - this.guiSettings = {...settings?.ui, ...this.guiSettings}; + this.guiSettings = {...this.guiSettings, ...settings?.ui}; return (await this.http.post('/settings', settings)).data.modified; } catch (error) { return formatAxiosError(error as Error | AxiosError); From 931664ca55c8e44798d9d34d1583e7199bb9fc9c Mon Sep 17 00:00:00 2001 From: Egbert Bouman Date: Fri, 13 Dec 2024 15:43:29 +0100 Subject: [PATCH 2/2] Fix is_bencoded --- src/tribler/core/tunnel/community.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tribler/core/tunnel/community.py b/src/tribler/core/tunnel/community.py index 06ad145a46..f115c15c74 100644 --- a/src/tribler/core/tunnel/community.py +++ b/src/tribler/core/tunnel/community.py @@ -51,7 +51,14 @@ def is_bencoded(x: bytes) -> bool: """ Returns True is x appears to be valid bencoded byte string. """ - return bdecode(x) is not None + if not isinstance(x, bytes): + msg = f'Expected bytes, got {type(x).__name__}' + raise TypeError(msg) + try: + decoded = bdecode(x) + except RuntimeError: + decoded = None + return decoded is not None class TriblerTunnelSettings(HiddenTunnelSettings):