diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 136b2c2ac3..2761390308 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -429,7 +429,8 @@ class View { * @param int $from * @param int $to * @return bool|mixed - * @throws \OCP\Files\InvalidPathException, \OCP\Files\UnseekableException + * @throws \OCP\Files\InvalidPathException + * @throws \OCP\Files\UnseekableException */ public function readfilePart($path, $from, $to) { $this->assertPathLength($path); @@ -450,9 +451,8 @@ class View { $size = ftell($handle) - $from; return $size; } - else { - throw new \OCP\Files\UnseekableException('fseek error'); - } + + throw new \OCP\Files\UnseekableException('fseek error'); } return false; } diff --git a/lib/private/legacy/files.php b/lib/private/legacy/files.php index 6327a0895e..ad5ba6d94a 100644 --- a/lib/private/legacy/files.php +++ b/lib/private/legacy/files.php @@ -51,16 +51,16 @@ class OC_Files { const UPLOAD_MIN_LIMIT_BYTES = 1048576; // 1 MiB - private static $MULTIPART_BOUNDARY = ''; + private static $multipartBoundary = ''; /** * @return string */ private static function getBoundary() { - if (empty(self::$MULTIPART_BOUNDARY)) { - self::$MULTIPART_BOUNDARY = md5(mt_rand()); + if (empty(self::$multipartBoundary)) { + self::$multipartBoundary = md5(mt_rand()); } - return self::$MULTIPART_BOUNDARY; + return self::$multipartBoundary; } /** @@ -101,7 +101,7 @@ class OC_Files { * @param string $files ; separated list of files to download * @param array $params ; 'head' boolean to only send header of the request ; 'range' http range header */ - public static function get($dir, $files, $params = array( 'head' => false )) { + public static function get($dir, $files, $params = null) { $view = \OC\Files\Filesystem::getView(); $getType = self::FILE; @@ -115,7 +115,7 @@ class OC_Files { if (!is_array($files)) { $filename = $dir . '/' . $files; if (!$view->is_dir($filename)) { - self::getSingleFile($view, $dir, $files, $params); + self::getSingleFile($view, $dir, $files, is_null($params) ? array() : $params); return; } } diff --git a/lib/public/Files/UnseekableException.php b/lib/public/Files/UnseekableException.php index fda9369769..b59f844ce2 100644 --- a/lib/public/Files/UnseekableException.php +++ b/lib/public/Files/UnseekableException.php @@ -30,5 +30,6 @@ namespace OCP\Files; /** * Exception for seek problem + * @since 9.1.0 */ class UnseekableException extends \Exception {}