MaterialFiles icon indicating copy to clipboard operation
MaterialFiles copied to clipboard

Unable to Add more than Two SFTP Servers

Open ankitpati opened this issue 3 years ago • 3 comments

Using the Play Store version, adding upto two SFTP servers works just fine, but when I add the third one, the first one just vanishes from the top of the pull-out drawer as well as from Settings > Storage.

The newly added one and the second one work fine at this point. If I repeat the above process with a fourth server, then the second one vanishes and I can only use the third and fourth, and so on.

I’ve tried adding using the “+ Add Storage” option in the pull-out, and also the “+” FAB in the Settings > Storage section.

I’ll be glad to provide logs if required.

ankitpati avatar May 04 '22 12:05 ankitpati

I can't reproduce this locally and I was able to add 3 SFTP servers. Could you your upload a video showing what exactly you did to trigger this? Note that you don't need to use actual hostname/username/password for the video if you press "Add" instead of "Connect and add".

zhanghai avatar May 04 '22 21:05 zhanghai

https://user-images.githubusercontent.com/6301593/167088170-35474445-53a8-4b97-bf29-5a326f8effa2.mp4

Using just the “Add” button increases the limit from 2 to 4 items, but the problem is still there.

ankitpati avatar May 06 '22 07:05 ankitpati

It seems that 5 somehow replaced 3. However, the app logic is that replace only happens when the ID of two storage matches, which is a random long for a newly created storage. And I also checked that the Random is always initialized with a seed relavent to system time. So this is indeed weird. https://github.com/zhanghai/MaterialFiles/blob/e424dcc0ee2732681c026c00bdd3a6da4b327cd5/app/src/main/java/me/zhanghai/android/files/storage/EditSftpServerFragment.kt#L362 https://github.com/zhanghai/MaterialFiles/blob/e424dcc0ee2732681c026c00bdd3a6da4b327cd5/app/src/main/java/me/zhanghai/android/files/storage/EditSftpServerFragment.kt#L239-L243 https://github.com/zhanghai/MaterialFiles/blob/e424dcc0ee2732681c026c00bdd3a6da4b327cd5/app/src/main/java/me/zhanghai/android/files/storage/SftpServer.kt#L29-L35 https://github.com/zhanghai/MaterialFiles/blob/e424dcc0ee2732681c026c00bdd3a6da4b327cd5/app/src/main/java/me/zhanghai/android/files/storage/Storages.kt#L13-L23

Meanwhile, I was able to add 6 SFTP servers normally, so this is indeed strange... 🤔 sftp

zhanghai avatar May 06 '22 08:05 zhanghai