diff options
author | Piotr Filiciak <piotr@filiciak.pl> | 2016-05-20 18:16:44 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-05-20 18:16:44 +0200 |
commit | 9999e05660637c77947c71656d2f03d841e19ab9 (patch) | |
tree | 3eac375c092a2013e7d9fdb6be8d0f74d298defd /apps/files_sharing | |
parent | 59a85a4c76b80658d9373e3acf4f71b872b244a0 (diff) | |
download | nextcloud-server-9999e05660637c77947c71656d2f03d841e19ab9.tar.gz nextcloud-server-9999e05660637c77947c71656d2f03d841e19ab9.zip |
Http Range requests support in downloads
Http range requests support is required for video preview
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/lib/controllers/sharecontroller.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/files_sharing/lib/controllers/sharecontroller.php b/apps/files_sharing/lib/controllers/sharecontroller.php index 72294f6b26f..8662765d196 100644 --- a/apps/files_sharing/lib/controllers/sharecontroller.php +++ b/apps/files_sharing/lib/controllers/sharecontroller.php @@ -484,16 +484,25 @@ class ShareController extends Controller { $this->emitAccessShareHook($share); + $server_params = array( 'head' => $this->request->getMethod() == 'HEAD' ); + + /** + * Http range requests support + */ + if (isset($_SERVER['HTTP_RANGE'])) { + $server_params['range'] = $this->request->getHeader('Range'); + } + // download selected files if (!is_null($files) && $files !== '') { // FIXME: The exit is required here because otherwise the AppFramework is trying to add headers as well // after dispatching the request which results in a "Cannot modify header information" notice. - OC_Files::get($originalSharePath, $files_list, $_SERVER['REQUEST_METHOD'] == 'HEAD'); + OC_Files::get($originalSharePath, $files_list, $server_params); exit(); } else { // FIXME: The exit is required here because otherwise the AppFramework is trying to add headers as well // after dispatching the request which results in a "Cannot modify header information" notice. - OC_Files::get(dirname($originalSharePath), basename($originalSharePath), $_SERVER['REQUEST_METHOD'] == 'HEAD'); + OC_Files::get(dirname($originalSharePath), basename($originalSharePath), $server_params); exit(); } } |