Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Better handle null when updating device names #2034

Open
1 of 2 tasks
TheOneWithTheBraid opened this issue Feb 13, 2025 · 2 comments
Open
1 of 2 tasks

Better handle null when updating device names #2034

TheOneWithTheBraid opened this issue Feb 13, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@TheOneWithTheBraid
Copy link
Contributor

Checklist

  • I could not find a solution in the documentation, the existing issues or discussions.
  • I already asked for help in the chat

In which Project did the bug appear?

Other

If you selected "Other" as Project, please enter in which project the bug occurred.

matrix-dart-sdk

On which platform did the bug appear?

Android

SDK Version

v0.38.0

Describe the problem caused by this bug

The Client.updateDevice() method accepts a nullable String as displayName. Sadly, when the displayName is null, the dispatched request will omit the parameter. So, in fact, it is impossible to use the SDK to remove the display name of a device.

https://spec.matrix.org/latest/client-server-api/#put_matrixclientv3devicesdeviceid

Steps To Reproduce

No response

Screenshots or Logs

No response

Security related

No response

@TheOneWithTheBraid TheOneWithTheBraid added the bug Something isn't working label Feb 13, 2025
@krille-chan
Copy link
Contributor

Would it work to just send an empty string instead? Element Web seems to does the same when trying to delete the displayname

@krille-chan krille-chan self-assigned this Feb 17, 2025
@TheOneWithTheBraid
Copy link
Contributor Author

TheOneWithTheBraid commented Feb 17, 2025

Nope, sadly an empty display name causes the device to appear with an empty String. My suggestion is to simply send the null value since there is no other parameter anyway. If a client calls the function, they can validate the data themselves.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants