mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-08 07:10:56 +03:00
webdav: fix permission errors if the client try to read multiple times
This commit is contained in:
@@ -136,8 +136,6 @@ func (f *webDavFile) Read(p []byte) (n int, err error) {
|
||||
return 0, errTransferAborted
|
||||
}
|
||||
if atomic.LoadInt32(&f.readTryed) == 0 {
|
||||
atomic.StoreInt32(&f.readTryed, 1)
|
||||
|
||||
if !f.Connection.User.HasPerm(dataprovider.PermDownload, path.Dir(f.GetVirtualPath())) {
|
||||
return 0, f.Connection.GetPermissionDeniedError()
|
||||
}
|
||||
@@ -146,6 +144,7 @@ func (f *webDavFile) Read(p []byte) (n int, err error) {
|
||||
f.Connection.Log(logger.LevelWarn, "reading file %#v is not allowed", f.GetVirtualPath())
|
||||
return 0, f.Connection.GetPermissionDeniedError()
|
||||
}
|
||||
atomic.StoreInt32(&f.readTryed, 1)
|
||||
}
|
||||
|
||||
f.Connection.UpdateLastActivity()
|
||||
|
||||
Reference in New Issue
Block a user