@@ -38,20 +38,20 @@ discard block |
||
| 38 | 38 | $files_list = json_decode($files); |
| 39 | 39 | // in case we get only a single file |
| 40 | 40 | if (!is_array($files_list)) { |
| 41 | - $files_list = [$files]; |
|
| 41 | + $files_list = [$files]; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * @psalm-taint-escape cookie |
| 46 | 46 | */ |
| 47 | 47 | function cleanCookieInput(string $value): string { |
| 48 | - if (strlen($value) > 32) { |
|
| 49 | - return ''; |
|
| 50 | - } |
|
| 51 | - if (preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) !== 1) { |
|
| 52 | - return ''; |
|
| 53 | - } |
|
| 54 | - return $value; |
|
| 48 | + if (strlen($value) > 32) { |
|
| 49 | + return ''; |
|
| 50 | + } |
|
| 51 | + if (preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) !== 1) { |
|
| 52 | + return ''; |
|
| 53 | + } |
|
| 54 | + return $value; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | * alphanumeric characters |
| 61 | 61 | */ |
| 62 | 62 | if (isset($_GET['downloadStartSecret'])) { |
| 63 | - $value = cleanCookieInput($_GET['downloadStartSecret']); |
|
| 64 | - if ($value !== '') { |
|
| 65 | - setcookie('ocDownloadStarted', $value, time() + 20, '/'); |
|
| 66 | - } |
|
| 63 | + $value = cleanCookieInput($_GET['downloadStartSecret']); |
|
| 64 | + if ($value !== '') { |
|
| 65 | + setcookie('ocDownloadStarted', $value, time() + 20, '/'); |
|
| 66 | + } |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $server_params = [ 'head' => \OC::$server->getRequest()->getMethod() === 'HEAD' ]; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * Http range requests support |
| 73 | 73 | */ |
| 74 | 74 | if (isset($_SERVER['HTTP_RANGE'])) { |
| 75 | - $server_params['range'] = \OC::$server->getRequest()->getHeader('Range'); |
|
| 75 | + $server_params['range'] = \OC::$server->getRequest()->getHeader('Range'); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | OC_Files::get($dir, $files_list, $server_params); |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | OCP\User::checkLoggedIn(); |
| 33 | 33 | \OC::$server->getSession()->close(); |
| 34 | 34 | |
| 35 | -$files = isset($_GET['files']) ? (string)$_GET['files'] : ''; |
|
| 36 | -$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : ''; |
|
| 35 | +$files = isset($_GET['files']) ? (string) $_GET['files'] : ''; |
|
| 36 | +$dir = isset($_GET['dir']) ? (string) $_GET['dir'] : ''; |
|
| 37 | 37 | |
| 38 | 38 | $files_list = json_decode($files); |
| 39 | 39 | // in case we get only a single file |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | -$server_params = [ 'head' => \OC::$server->getRequest()->getMethod() === 'HEAD' ]; |
|
| 69 | +$server_params = ['head' => \OC::$server->getRequest()->getMethod() === 'HEAD']; |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * Http range requests support |