You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Niklas Gustavsson (JIRA)" <ji...@apache.org> on 2011/05/31 15:30:47 UTC

[jira] [Closed] (FTPSERVER-414) STAT / creates invalid directory listing (with Patch)

     [ https://issues.apache.org/jira/browse/FTPSERVER-414?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niklas Gustavsson closed FTPSERVER-414.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.1.0
                   1.0.6
         Assignee: Niklas Gustavsson

> STAT / creates invalid directory listing (with Patch)
> -----------------------------------------------------
>
>                 Key: FTPSERVER-414
>                 URL: https://issues.apache.org/jira/browse/FTPSERVER-414
>             Project: FtpServer
>          Issue Type: Bug
>          Components: Server
>    Affects Versions: 1.0.5
>            Reporter: Emmeran Seehuber
>            Assignee: Niklas Gustavsson
>             Fix For: 1.0.6, 1.1.0
>
>
> Some ftp clients (e.g. Cyberduck on Mac OS X) use the STAT command to list directores. The reply contains an invalid status code in the last line, which causes the ftp client to ignore the last line. So the last file in the directory does not show up in the ftp client listing:
> 614869 [pool-3-thread-6] INFO org.apache.ftpserver.listener.nio.FtpLoggingFilter - RECEIVED: STAT /
> 615085 [pool-3-thread-6] INFO org.apache.ftpserver.listener.nio.FtpLoggingFilter - SENT: 200---w-------   1 rototor@rototor.de rototor@rototor.de        21581 Jan  1  1970 uxz.pdf
> --w-------   1 rototor@rototor.de rototor@rototor.de         5788 Jan  1  1970 abc.pdf
> --w-------   1 rototor@rototor.de rototor@rototor.de       415447 Jan  1  1970 def.pdf
> 200   --w-------   1 rototor@rototor.de rototor@rototor.de       822782 Jan  1  1970 xyz.pdf
> I dont know if this is a bug in the ftp client. But at least the following patch to the STAT command fixes the problem for me:
> diff --git a/org/apache/ftpserver/command/impl/STAT.java b/org/apache/ftpserver/command/impl/STAT.java
> index 19674b2..5ca76c1 100644
> --- a/org/apache/ftpserver/command/impl/STAT.java
> +++ b/org/apache/ftpserver/command/impl/STAT.java
> @@ -77,10 +77,6 @@ public class STAT extends AbstractCommand {
>                  
>                  String dirList = directoryLister.listFiles(parsedArg, 
>                          session.getFileSystemView(), LIST_FILE_FORMATER);
> +		// DefaultFtpReply prepends the status code to the last line.
> +                // This causes the STAT directory listing to loose the last directory entry in some clients
> +                // e.g. Cyberduck
> +		dirList += "   \n";
>  
>                  session
>                  .write(new DefaultFtpReply(
> With this patch applied the output looks like this:
> 615085 [pool-3-thread-6] INFO org.apache.ftpserver.listener.nio.FtpLoggingFilter - SENT: 200---w-------   1 rototor@rototor.de rototor@rototor.de        21581 Jan  1  1970 uxz.pdf
> --w-------   1 rototor@rototor.de rototor@rototor.de         5788 Jan  1  1970 abc.pdf
> --w-------   1 rototor@rototor.de rototor@rototor.de       415447 Jan  1  1970 def.pdf
> --w-------   1 rototor@rototor.de rototor@rototor.de       822782 Jan  1  1970 xyz.pdf
> 200
> And know the clients work correctly.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira