PyFilesystem / pyfilesystem

Python filesystem abstraction layer
http://pyfilesystem.org/
BSD 3-Clause "New" or "Revised" License
288 stars 63 forks source link

SFTPFS: improper isfile/isdir() results for URL pointing to a file #216

Open zopyx opened 9 years ago

zopyx commented 9 years ago

Point SFTPFS to a file instead of a directory returns improper results for isdir()

from fs.sftpfs import SFTPFS

handle = SFTPFS('localhost', '/tmp')
print handle.isdir('.') # True
print handle.isfile('.') # False

handle = SFTPFS('localhost', '/tmp/fswrapper.py')
print handle.isdir('.') # True !!!!!!
print handle.isfile('.') # True
willmcgugan commented 9 years ago

I think the bug there is that it let you open a filesystem with a file path in the first place. It would probably be best to throw an exception in the constructor.