janwytze / stackftp

Stack webdav to ftp server
0 stars 2 forks source link

Removing directory filezilla not working #39

Closed janwytze closed 7 years ago

janwytze commented 7 years ago

Removing a directory is not working in filezilla.
The problem is that when the remove command is called the path doesn't end with /, so the isDirectory() will return false.

Nautilus ignores if the file is a directory.

We should use a different way to check if a file is a directory. This can't be done directly with webdav... Only the parent's directory list knows that it is a directory or not.

janwytze commented 7 years ago

The list method in StackFile is returning the path with a trailing slash.
So the file list is right.

The StackFile instance of the directory has been initialized before in the list. Maybe we could build something with caching. But when it is a direct remove command the directory isn't in the cache so we can't check if it is a directory. Also when the directory is removed and a file with the same name is created the caching would fail.

janwytze commented 7 years ago

The problem is that filezilla uses RMD(Remove directory I think) and nautilus uses DELE(Just delete I think). One way to check if it is a directory is when the path doesn't end with /, do a list request on the parent directory to check if it is a directory of not.

Please let me know if you have a better way in mind...

janwytze commented 7 years ago

I forgot that the first result on a Webdav(sardine) list is the directory itself, so I have fixed this issue by reading the first item of the list.