jackgene / sftp-servlet-container

A servlet container that uses SFTP instead of HTTP as its access protocol.
1 stars 0 forks source link

Investigate the possibility of treating only files with trailing / as directories #3

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In the current implementation, and resource that isn't a file (does not map to 
a servlet resource, or isn't README.txt) is automatically considered a 
directory. This is because the nature of servlet applications is such that any 
path can conceivably be a directory for some servlet resource.

However, this results in things like:
ls /nonexistent.txt

returning:
/nonexistent.txt/README.txt

See if a more elegant solution can be found.

Original issue reported on code.google.com by jackg...@gmail.com on 6 Feb 2012 at 4:25

GoogleCodeExporter commented 8 years ago

Original comment by jackg...@gmail.com on 8 Jul 2012 at 4:27

GoogleCodeExporter commented 8 years ago
Investigated, and this is not feasible.

When an SFTP command like:
cd /foo
ls /foo

Is attempted (on the MacOS command line SFTP client), it attempts 
FileSystemView#getFile(path) in various forms:
getFile("/foo")
getFile("/foo/")
etc

So modifying behavior based on trailing-slash would not help as the client 
attempts to look for the file with and without the trailing slash. In fact, the 
system would misbehave as a result of this (all directories become 
non-existent, as the client attempts the non-slash version, and the system says 
it's non-existent).

Original comment by jackg...@gmail.com on 2 Feb 2014 at 1:35