Conditions | 7 |
Paths | 4 |
Total Lines | 24 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 17.5839 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | 3 | public function getUploadSize($path) { |
|
30 | 3 | $uploadSize = null; |
|
31 | |||
32 | 3 | $requestMethod = $this->request->getMethod(); |
|
33 | 3 | $isRemoteScript = $this->isScriptName('remote.php'); |
|
34 | // Are we uploading anything? |
||
35 | 3 | if (in_array($requestMethod, ['MOVE', 'PUT']) && $isRemoteScript) { |
|
36 | // v1 && v2 Chunks are not scanned |
||
37 | if ( |
||
38 | \OC_FileChunking::isWebdavChunk() |
||
39 | || ($requestMethod === 'PUT' && strpos($path, 'uploads/') === 0) |
||
40 | ) { |
||
41 | return null; |
||
42 | } |
||
43 | |||
44 | if ($requestMethod === 'PUT') { |
||
45 | $uploadSize = (int)$this->request->getHeader('CONTENT_LENGTH'); |
||
46 | } else { |
||
47 | $uploadSize = (int)$this->request->getHeader('OC_TOTAL_LENGTH'); |
||
48 | } |
||
49 | } |
||
50 | |||
51 | 3 | return $uploadSize; |
|
52 | } |
||
53 | |||
64 |