mirror of
https://github.com/nextcloud/server.git
synced 2026-06-06 15:23:17 -04:00
Return whole file if range request cannot be granted due to encryption
Whenenver range headers are set and encryption is enabled, it is not possible to automatically fseek() to the proper position. To avoid returning corrupt/invalid data or causing a decryption error, the range headers are stripped so that the SabreDAV code in httpGet() returns the whole file.
This commit is contained in:
parent
a4b416f115
commit
cc8c1d8e07
1 changed files with 22 additions and 0 deletions
|
|
@ -33,6 +33,11 @@ class OC_Connector_Sabre_Server extends Sabre\DAV\Server {
|
|||
*/
|
||||
private $overLoadedUri = null;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
private $ignoreRangeHeader = false;
|
||||
|
||||
public function getRequestUri() {
|
||||
|
||||
if (!is_null($this->overLoadedUri)) {
|
||||
|
|
@ -59,6 +64,23 @@ class OC_Connector_Sabre_Server extends Sabre\DAV\Server {
|
|||
return $result;
|
||||
}
|
||||
|
||||
public function getHTTPRange() {
|
||||
if ($this->ignoreRangeHeader) {
|
||||
return null;
|
||||
}
|
||||
return parent::getHTTPRange();
|
||||
}
|
||||
|
||||
protected function httpGet($uri) {
|
||||
$range = $this->getHTTPRange();
|
||||
|
||||
if (OC_App::isEnabled('files_encryption') && $range) {
|
||||
// encryption does not support range requests
|
||||
$this->ignoreRangeHeader = true;
|
||||
}
|
||||
return parent::httpGet($uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \Sabre\DAV\Server
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue