Skip to content

Commit

Permalink
Merge 4058275 into e811e71
Browse files Browse the repository at this point in the history
  • Loading branch information
ulope committed Jul 26, 2014
2 parents e811e71 + 4058275 commit fe45006
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion paramiko/sftp_attr.py
Expand Up @@ -210,12 +210,15 @@ def __str__(self):
# not all servers support uid/gid
uid = self.st_uid
gid = self.st_gid
size = self.st_size
if uid is None:
uid = 0
if gid is None:
gid = 0
if size is None:
size = 0

return '%s 1 %-8d %-8d %8d %-12s %s' % (ks, uid, gid, self.st_size, datestr, filename)
return '%s 1 %-8d %-8d %8d %-12s %s' % (ks, uid, gid, size, datestr, filename)

def asbytes(self):
return b(str(self))
5 changes: 5 additions & 0 deletions tests/test_sftp.py
Expand Up @@ -776,6 +776,11 @@ def test_O_non_utf8_data(self):
sftp.remove('%s/nonutf8data' % FOLDER)


def test_sftp_attributes_empty_str(self):
sftp_attributes = SFTPAttributes()
self.assertEqual(str(sftp_attributes), "?--------- 1 0 0 0 (unknown date) ?")


if __name__ == '__main__':
SFTPTest.init_loopback()
# logging is required by test_N_file_with_percent
Expand Down

0 comments on commit fe45006

Please sign in to comment.