mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
sftpd download: remove check for download size
some clients, for example rclone can request only part of a file, we have no way to detect this so we haven't return an error if the downloaded size does not match the file size
This commit is contained in:
@@ -225,36 +225,6 @@ func TestUploadResumeInvalidOffset(t *testing.T) {
|
||||
os.Remove(testfile)
|
||||
}
|
||||
|
||||
func TestIncompleteDownload(t *testing.T) {
|
||||
testfile := "testfile"
|
||||
file, _ := os.Create(testfile)
|
||||
transfer := Transfer{
|
||||
file: file,
|
||||
path: file.Name(),
|
||||
start: time.Now(),
|
||||
bytesSent: 0,
|
||||
bytesReceived: 0,
|
||||
user: dataprovider.User{
|
||||
Username: "testuser",
|
||||
},
|
||||
connectionID: "",
|
||||
transferType: transferDownload,
|
||||
lastActivity: time.Now(),
|
||||
isNewFile: false,
|
||||
protocol: protocolSFTP,
|
||||
transferError: nil,
|
||||
isFinished: false,
|
||||
minWriteOffset: 0,
|
||||
expectedSize: 10,
|
||||
lock: new(sync.Mutex),
|
||||
}
|
||||
err := transfer.Close()
|
||||
if err == nil || !strings.Contains(err.Error(), "incomplete download") {
|
||||
t.Error("upoload must fail the expected size does not match")
|
||||
}
|
||||
os.Remove(testfile)
|
||||
}
|
||||
|
||||
func TestReadWriteErrors(t *testing.T) {
|
||||
testfile := "testfile"
|
||||
file, _ := os.Create(testfile)
|
||||
|
||||
Reference in New Issue
Block a user