diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-05-06 18:41:06 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-05-06 18:41:06 +0200 |
commit | d16bb09aed51cce5dc08ba3f3bbd629b4351b3f0 (patch) | |
tree | 2c1141f58b6df8fb6791918ec23b7480f81bf1f0 /lib/private/files.php | |
parent | b9f059bd3ee75247058bd5eb9908f6c33ffa08e2 (diff) | |
parent | 9b4643f3865f5f14483b2e4618967f6cc91b0a22 (diff) | |
download | nextcloud-server-d16bb09aed51cce5dc08ba3f3bbd629b4351b3f0.tar.gz nextcloud-server-d16bb09aed51cce5dc08ba3f3bbd629b4351b3f0.zip |
Merge pull request #8045 from josh4trunks/nginx_x-accel_send_uri
Send URI instead of filepath to NGINX for X-Accel
Diffstat (limited to 'lib/private/files.php')
-rw-r--r-- | lib/private/files.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/private/files.php b/lib/private/files.php index 3affcf10449..c435f8d1684 100644 --- a/lib/private/files.php +++ b/lib/private/files.php @@ -152,7 +152,7 @@ class OC_Files { /** @var $storage \OC\Files\Storage\Storage */ list($storage) = $view->resolvePath($filename); if ($storage->isLocal()) { - self::addSendfileHeader(\OC\Files\Filesystem::getLocalFile($filename)); + self::addSendfileHeader($filename); } else { \OC\Files\Filesystem::readfile($filename); } @@ -167,9 +167,11 @@ class OC_Files { */ private static function addSendfileHeader($filename) { if (isset($_SERVER['MOD_X_SENDFILE_ENABLED'])) { + $filename = \OC\Files\Filesystem::getLocalFile($filename); header("X-Sendfile: " . $filename); } if (isset($_SERVER['MOD_X_SENDFILE2_ENABLED'])) { + $filename = \OC\Files\Filesystem::getLocalFile($filename); if (isset($_SERVER['HTTP_RANGE']) && preg_match("/^bytes=([0-9]+)-([0-9]*)$/", $_SERVER['HTTP_RANGE'], $range)) { $filelength = filesize($filename); @@ -185,6 +187,7 @@ class OC_Files { } if (isset($_SERVER['MOD_X_ACCEL_REDIRECT_ENABLED'])) { + $filename = \OC::$WEBROOT . '/data' . \OC\Files\Filesystem::getRoot() . $filename; header("X-Accel-Redirect: " . $filename); } } |