Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

In comma-separated list of addresses, commas become part of the addresses #2076

Open
kidhanis opened this issue Apr 10, 2024 · 0 comments
Open

Comments

@kidhanis
Copy link

I added two addresses to a device. However, the other device is the one that usually finds the phone and not vice versa.
It seems that the app has a problem with commas in the list of devices because everything works like expected when I add only one address.

Steps to reproduce

  • Go to the Devices tab and tap "+" to Add Device
  • Add a Device ID (like the example ID in the Syncthing docs). Then add a name, like TestDevice.
  • In the addreses, add two values separated by comma and space. I'll use tcp://192.168.0.0, dynamic for this example.
    List of addresses
  • Add device to finish.
  • Go to Menu -> Web GUI, scroll to the Remote Devices section, and click on TestDevice. There should be two values in the Address row in separate lines.

Expected results

The two values in the Addresses row should be tcp://192.168.0.0 and dynamic

Actual results

The first value is tcp://192.168.0.0,. There shouldn't be a comma at the end.
Address with comma

While on the Web GUI, tap Edit under TestDevice, then go to the Advanced tab, the Addresses box says tcp://192.168.0.0,, dynamic.
Two commas after address

If I now Save to close the Edit Device (TestDevice) window without making any changes, and check the Addresses row again, the first address is shown without the comma. It seems that the Syncthing GUI fixed the address.

After this, I exit the Web GUI and click on TestDevice on the Devices tab on the app, and the value of the addresses is now tcp://192.168.0.0 dynamic.
No commas

This is what works. In the app I need to separate addresses using only spaces for the values to be stored correctly.

Possible cause

The TextWatcher for the address box calls the two following methods:

private List<String> persistableAddresses(CharSequence userInput) {
return isEmpty(userInput)
? DYNAMIC_ADDRESS
: Arrays.asList(userInput.toString().split(" "));
}
private String displayableAddresses() {
List<String> list = DYNAMIC_ADDRESS.equals(mDevice.addresses)
? DYNAMIC_ADDRESS
: mDevice.addresses;
return TextUtils.join(" ", list);
}

This looks to me that the app is processing addresses using spaces as delimiters, instead of commas like Syncthing does.

Version Information

App Version: 1.27.5
Syncthing Version: v1.27.5
Android Version: Android 11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant