Fix some other log notices when trying to access non-existing file with a viewer
This commit is contained in:
parent
d24863e97e
commit
897015ec10
File diff suppressed because one or more lines are too long
@ -28,17 +28,17 @@ class DownloadResponse extends \OCP\AppFramework\Http\Response {
|
|||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->path = $path;
|
$this->path = $path;
|
||||||
|
|
||||||
$this->view = new View('/' . $user);
|
$this->view = new View('/' . $user);
|
||||||
if (!$this->view->file_exists($path)){
|
if (!$this->view->file_exists($path)){
|
||||||
$this->setStatus(Http::STATUS_NOT_FOUND);
|
parent::setStatus(Http::STATUS_NOT_FOUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render(){
|
public function render(){
|
||||||
if ($this->status === Http::STATUS_NOT_FOUND){
|
if (parent::getStatus() === Http::STATUS_NOT_FOUND){
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$info = $this->view->getFileInfo($this->path);
|
$info = $this->view->getFileInfo($this->path);
|
||||||
$this->ETag = $info['etag'];
|
$this->ETag = $info['etag'];
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ class DownloadResponse extends \OCP\AppFramework\Http\Response {
|
|||||||
$size = strlen($data['content']);
|
$size = strlen($data['content']);
|
||||||
|
|
||||||
|
|
||||||
if (!is_null($this->request->server['HTTP_RANGE'])){
|
if (isset($this->request->server['HTTP_RANGE']) && !is_null($this->request->server['HTTP_RANGE'])){
|
||||||
$isValidRange = preg_match('/^bytes=\d*-\d*(,\d*-\d*)*$/', $this->request->server['HTTP_RANGE']);
|
$isValidRange = preg_match('/^bytes=\d*-\d*(,\d*-\d*)*$/', $this->request->server['HTTP_RANGE']);
|
||||||
if (!$isValidRange){
|
if (!$isValidRange){
|
||||||
return $this->sendRangeNotSatisfiable($size);
|
return $this->sendRangeNotSatisfiable($size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user