aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/files.php
diff options
context:
space:
mode:
authorjosh4trunks <joshruehlig@gmail.com>2014-04-03 20:46:54 -0700
committerjosh4trunks <joshruehlig@gmail.com>2014-04-03 20:46:54 -0700
commit9b4643f3865f5f14483b2e4618967f6cc91b0a22 (patch)
tree9976fcfecfa14ad4464a02c6105c970c2ce10724 /lib/private/files.php
parentbf7624fb255b7af534f5d6a740dd6dc9799cfc63 (diff)
downloadnextcloud-server-9b4643f3865f5f14483b2e4618967f6cc91b0a22.tar.gz
nextcloud-server-9b4643f3865f5f14483b2e4618967f6cc91b0a22.zip
Send URI instead of filepath to NGINX for X-Accel
Diffstat (limited to 'lib/private/files.php')
-rw-r--r--lib/private/files.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/private/files.php b/lib/private/files.php
index bfe6d3c02da..a377c196cdc 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);
}
}