syncthing / syncthing-android

Wrapper of syncthing for Android.
https://syncthing.net/
Mozilla Public License 2.0
3.16k stars 362 forks source link

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

Open kidhanis opened 3 months ago

kidhanis commented 3 months ago

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

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:

https://github.com/syncthing/syncthing-android/blob/7904afd1ff43240ba69b8289719df5e01bde3ed3/app/src/main/java/com/nutomic/syncthingandroid/activities/DeviceActivity.java#L406-L417

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