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) {
@@ 365-372 (lines=8) @@
362
363
		//detect aborted upload
364
		if (isset ($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {
365
			if (isset($_SERVER['CONTENT_LENGTH'])) {
366
				$expected = $_SERVER['CONTENT_LENGTH'];
367
				if ($bytesWritten != $expected) {
368
					$chunk_handler->remove($info['index']);
369
					throw new BadRequest(
370
						'expected filesize ' . $expected . ' got ' . $bytesWritten);
371
				}
372
			}
373
		}
374
375
		if ($chunk_handler->isComplete()) {