33import io
44import six
55import threading
6+ import operator
67import logging
78
89import webdav2 .client as wc
@@ -238,7 +239,10 @@ def listdir(self, path):
238239 raise errors .DirectoryExpected (path )
239240
240241 dir_list = self .client .list (_path )
241- return map (six .u , dir_list ) if six .PY2 else dir_list
242+ if six .PY2 :
243+ dir_list = map (operator .methodcaller ('decode' ), dir_list )
244+
245+ return list (map (operator .methodcaller ('rstrip' , '/' ), dir_list ))
242246
243247 def makedir (self , path , permissions = None , recreate = False ):
244248 _path = self .validatepath (path )
@@ -312,6 +316,8 @@ def copy(self, src_path, dst_path, overwrite=False):
312316 _dst_path = self .validatepath (dst_path )
313317
314318 with self ._lock :
319+ if not self .getinfo (_src_path ).is_file :
320+ raise errors .FileExpected (src_path )
315321 if not overwrite and self .exists (_dst_path ):
316322 raise errors .DestinationExists (dst_path )
317323 try :
@@ -325,6 +331,8 @@ def move(self, src_path, dst_path, overwrite=False):
325331 _src_path = self .validatepath (src_path )
326332 _dst_path = self .validatepath (dst_path )
327333
334+ if not self .getinfo (_src_path ).is_file :
335+ raise errors .FileExpected (src_path )
328336 if not overwrite and self .exists (_dst_path ):
329337 raise errors .DestinationExists (dst_path )
330338 with self ._lock :
0 commit comments