Closed drewtato closed 1 year ago
The current implementation of DavFile::seek is incorrect.
DavFile::seek
https://github.com/messense/aliyundrive-webdav/blob/290718e3fdfae2fb184d0039caacdd68767e878f/src/vfs.rs#L964
SeekFrom::End is supposed to add to the total length. This typically uses either zero or a negative number for pos. This pull request changes - to +.
SeekFrom::End
pos
-
+
SeekFrom::End(pos) => (self.file.size as i64 + pos) as u64,
I found this from doing a code search on Github. I also found some implementations of Seek that use this correctly, such as the one from clap.
Seek
SeekFrom::End(pos) => (self.items.len() as i64).saturating_add(pos).max(0) as u64,
Hopefully this doesn't break things that were relying on this. There weren't any tests (in rust at least) to verify.
The current implementation of
DavFile::seek
is incorrect.https://github.com/messense/aliyundrive-webdav/blob/290718e3fdfae2fb184d0039caacdd68767e878f/src/vfs.rs#L964
SeekFrom::End
is supposed to add to the total length. This typically uses either zero or a negative number forpos
. This pull request changes-
to+
.I found this from doing a code search on Github. I also found some implementations of
Seek
that use this correctly, such as the one from clap.Hopefully this doesn't break things that were relying on this. There weren't any tests (in rust at least) to verify.