replaced UnseekableException => NotPermittedException

This commit is contained in:
Piotr Filiciak 2016-05-25 15:38:48 +02:00
parent 8c439643a1
commit 002a7f8294
3 changed files with 5 additions and 40 deletions

View File

@ -275,7 +275,7 @@ class OC_Files {
$view->readfilePart($filename, $rangeArray[0]['from'], $rangeArray[0]['to']);
}
else {
// check if file is seekable (if not throw UnseekableException)
// check if file is seekable (if not throw NotPermittedException)
// we have to check it before body contents
$view->readfilePart($filename, $rangeArray[0]['size'], $rangeArray[0]['size']);
@ -289,7 +289,7 @@ class OC_Files {
}
echo "\r\n--".self::getBoundary()."--\r\n";
}
} catch (\OCP\Files\UnseekableException $ex) {
} catch (\OCP\Files\NotPermittedException $ex) {
// file is unseekable
header_remove('Accept-Ranges');
header_remove('Content-Range');

View File

@ -53,7 +53,7 @@ use OCP\Files\InvalidCharacterInPathException;
use OCP\Files\InvalidPathException;
use OCP\Files\NotFoundException;
use OCP\Files\ReservedWordException;
use OCP\Files\UnseekableException;
use OCP\Files\NotPermittedException;
use OCP\Files\Storage\ILockingStorage;
use OCP\IUser;
use OCP\Lock\ILockingProvider;
@ -430,7 +430,7 @@ class View {
* @param int $to
* @return bool|mixed
* @throws \OCP\Files\InvalidPathException
* @throws \OCP\Files\UnseekableException
* @throws \OCP\Files\NotPermittedException
*/
public function readfilePart($path, $from, $to) {
$this->assertPathLength($path);
@ -452,7 +452,7 @@ class View {
return $size;
}
throw new \OCP\Files\UnseekableException('fseek error');
throw new \OCP\Files\NotPermittedException('fseek error');
}
return false;
}

View File

@ -1,35 +0,0 @@
<?php
/**
* @author Piotr Filiciak <piotr@filiciak.pl>
*
* @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
/**
* Public interface of ownCloud for apps to use.
* Files/UnseekableException class
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
/**
* Exception for seek problem
* @since 9.1.0
*/
class UnseekableException extends \Exception {}