Skip to content

Commit 58ef2b4

Browse files
author
Martin Larralde
committed
Fix pos in WebDAVFile.seek and WebDAVFile.read
1 parent 33f42a6 commit 58ef2b4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

webdavfs/webdavfs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ def readable(self):
8989
def read(self, size=-1):
9090
if not self._mode.reading:
9191
raise IOError("File is not in read mode")
92-
if size != -1:
93-
self.pos += size
92+
self.pos = self.pos + size if size != -1 else self._get_data_size()
9493
return self.data.read(size)
9594

9695
def seekable(self):
@@ -111,6 +110,7 @@ def seek(self, pos, whence=Seek.set):
111110
raise ValueError('invalid value for whence')
112111

113112
self.data.seek(self.pos)
113+
return self.pos
114114

115115
def tell(self):
116116
return self.pos
@@ -223,8 +223,8 @@ def getinfo(self, path, namespaces=None):
223223
info_dict['basic']['is_dir'] = True
224224
info_dict['details']['type'] = int(ResourceType.directory)
225225
return Info(info_dict)
226-
except we.RemoteResourceNotFound:
227-
raise errors.ResourceNotFound(path)
226+
except we.RemoteResourceNotFound as exc:
227+
raise errors.ResourceNotFound(path, exc=exc)
228228

229229
def listdir(self, path):
230230
self.check()

0 commit comments

Comments
 (0)