mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 14:50:55 +03:00
sftpd: return the error Operation Unsupported for unexpected reads
a cloud based file cannot be opened for read and write at the same time. Return a proper error if a client try to do this. It can happen only for SFTP
This commit is contained in:
@@ -1680,6 +1680,13 @@ func TestTransferFailingReader(t *testing.T) {
|
||||
err = tr.Close()
|
||||
assert.NoError(t, err)
|
||||
|
||||
tr = newTransfer(baseTransfer, nil, nil, errRead)
|
||||
_, err = tr.ReadAt(buf, 0)
|
||||
assert.EqualError(t, err, errRead.Error())
|
||||
|
||||
err = tr.Close()
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = os.Remove(fsPath)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, connection.GetTransfers(), 0)
|
||||
|
||||
Reference in New Issue
Block a user