Code Duplication    Length = 6-8 lines in 2 locations

lib/private/connector/sabre/file.php 2 locations

@@ 144-149 (lines=6) @@
141
			// if content length is sent by client:
142
			// double check if the file was fully received
143
			// compare expected and actual size
144
			if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] !== 'LOCK') {
145
				$expected = $_SERVER['CONTENT_LENGTH'];
146
				if ($count != $expected) {
147
					throw new BadRequest('expected filesize ' . $expected . ' got ' . $count);
148
				}
149
			}
150
151
		} catch (\Exception $e) {
152
			if ($needsPartFile) {
@@ 377-384 (lines=8) @@
374
375
		//detect aborted upload
376
		if (isset ($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {
377
			if (isset($_SERVER['CONTENT_LENGTH'])) {
378
				$expected = $_SERVER['CONTENT_LENGTH'];
379
				if ($bytesWritten != $expected) {
380
					$chunk_handler->remove($info['index']);
381
					throw new BadRequest(
382
						'expected filesize ' . $expected . ' got ' . $bytesWritten);
383
				}
384
			}
385
		}
386
387
		if ($chunk_handler->isComplete()) {