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): 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);