Browse Source

Fix file size comparison

Signed-off-by: Joas Schilling <coding@schilljs.com>
tags/v13.0.0beta1
Joas Schilling 7 years ago
parent
commit
231bb47ae6
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      apps/dav/lib/Connector/Sabre/File.php

+ 2
- 2
apps/dav/lib/Connector/Sabre/File.php View File

@@ -146,7 +146,7 @@ class File extends Node implements IFile {
// double check if the file was fully received
// compare expected and actual size
if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {
$expected = $_SERVER['CONTENT_LENGTH'];
$expected = (int) $_SERVER['CONTENT_LENGTH'];
if ($count !== $expected) {
throw new BadRequest('expected filesize ' . $expected . ' got ' . $count);
}
@@ -409,7 +409,7 @@ class File extends Node implements IFile {
//detect aborted upload
if (isset ($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {
if (isset($_SERVER['CONTENT_LENGTH'])) {
$expected = $_SERVER['CONTENT_LENGTH'];
$expected = (int) $_SERVER['CONTENT_LENGTH'];
if ($bytesWritten !== $expected) {
$chunk_handler->remove($info['index']);
throw new BadRequest(

Loading…
Cancel
Save