wolpi / prim-ftpd

FTP server app for android
Other
580 stars 78 forks source link

Handle StartDir differently in case of VirtFS #354

Closed lmagyar closed 1 week ago

lmagyar commented 4 weeks ago

UPDATE: complete rewrite of this comment

Without this PR, pftpd VirtFS behaves errorneously:

With this PR:


Just fun fact: I made a version (https://github.com/lmagyar/prim-ftpd/tree/dev-dual-root-and-home-for-sshfs), where depending on SSHFS's start dir, / or nothing=user's home, it was able to see the / folder under /fs (when / is SSHFS's start dir), or the selected startDir, eg. /storage/emulated/0 under /fs (when ` is the SSHFS start dir), it was soo cool, but WinSCP got completely broken and couldn't figure out the reason, even my fake symlink experiments on/fs` etc. folders were broken, so gave up. :(

lmagyar commented 3 weeks ago

Now it's ready to review.

wolpi commented 3 weeks ago

but WinSCP got completely broken and couldn't figure out the reason

Over the years I had similar issues with some clients :smile:

With this PR:

Well, I also see that current code and behavior is not perfect. With current code it would be possible to access files on root folder which is not possible with new code. But would be ok for me to change this. Wit new code IDE complains about Paths.get() would require a higher API level than the App demands. On my test systems/devices that does not cause an issue but it might for people with old phones. Could you find a solution without Paths.get() ?

wolpi commented 3 weeks ago

Oh, and this change breaks my test script. tests/tests.py As it expects the old behavior. Thus some more work is required to switch to new behavior.

lmagyar commented 3 weeks ago

So, I think I've found finally an even better solution:

wolpi commented 1 week ago

That seems to be a good and elegant approach :+1: