[
https://issues.apache.org/jira/browse/VFS-179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12537488
]
Andrew Franklin commented on VFS-179:
-------------------------------------
I've just confirmed that the above solution will not work if the symbolic link
is for a file, I'll look at implementing something similar to how the
FtpFileObject handles symbolic links.
> Traversal of directory tree with FileSelector fails with symbolic links in
> FTP & SFTP
> -------------------------------------------------------------------------------------
>
> Key: VFS-179
> URL: https://issues.apache.org/jira/browse/VFS-179
> Project: Commons VFS
> Issue Type: Bug
> Reporter: Andrew Franklin
>
> It seems to me that when using the FileSelector to traverse a directory tree
> using SFTP, a symbolic link will return as type File (even when the link
> points to a directory), which will result in the directory node not being
> followed.
> For SFTP it seems that changing doGetType to explicitly deal with the link as
> FILE_OR_FOLDER seems to fix the issue. I'm not sure whether this would have
> any negative side effects...?
> /**
> * Determines the type of this file, returns null if the file does not
> * exist.
> */
> protected FileType doGetType() throws Exception
> {
> if (attrs == null)
> {
> statSelf();
> }
> if (attrs == null)
> {
> return FileType.IMAGINARY;
> }
> if ((attrs.getFlags() &
> SftpATTRS.SSH_FILEXFER_ATTR_PERMISSIONS) == 0)
> {
> throw new FileSystemException(
>
> "vfs.provider.sftp/unknown-permissions.error");
> }
> // A symbolic link might be a file or folder
> if(attrs.isLink())
> {
> return FileType.FILE_OR_FOLDER;
> }
> else if (attrs.isDir())
> {
> return FileType.FOLDER;
> }
> else
> {
> return FileType.FILE;
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.