mirror of
https://github.com/nextcloud/server.git
synced 2026-02-19 02:38:40 -05:00
fix(files): decrement quota by actual bytes written in stream_write
The quota is now decremented by the actual number of bytes written ($written) rather than the intended size. This ensures quota tracking stays accurate even if fwrite writes fewer (or more - i.e. from underlying buffering/etc) bytes than requested. Signed-off-by: Josh <josh.t.richards@gmail.com>
This commit is contained in:
parent
692d265d4a
commit
bd43cb7d04
1 changed files with 5 additions and 2 deletions
|
|
@ -78,7 +78,10 @@ class Quota extends Wrapper {
|
|||
$data = substr($data, 0, $this->limit);
|
||||
$size = $this->limit;
|
||||
}
|
||||
$this->limit -= $size;
|
||||
return fwrite($this->source, $data);
|
||||
$written = fwrite($this->source, $data);
|
||||
// Decrement quota by the actual number of bytes written ($written),
|
||||
// not the intended size
|
||||
$this->limit -= $written;
|
||||
return $written;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue