Skip to content

Commit

Permalink
Fix for the GUI settings not applying immediately (#8340)
Browse files Browse the repository at this point in the history
  • Loading branch information
egbertbouman authored Dec 13, 2024
2 parents e5dd276 + 931664c commit 96f5891
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/tribler/core/tunnel/community.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/tribler/ui/src/services/tribler.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export class TriblerService {

async setSettings(settings: Partial<Settings>): Promise<undefined | ErrorDict | boolean> {
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);
Expand Down

0 comments on commit 96f5891

Please sign in to comment.