Merge pull request #103 from pranavk/invalidurl
Respect default settings
This commit is contained in:
commit
7c4aa05c20
@ -47,6 +47,7 @@ class Application extends App {
|
|||||||
$c->query('AppName'),
|
$c->query('AppName'),
|
||||||
$c->query('Request'),
|
$c->query('Request'),
|
||||||
$c->query('CoreConfig'),
|
$c->query('CoreConfig'),
|
||||||
|
$c->query('AppConfig'),
|
||||||
$c->query('L10N'),
|
$c->query('L10N'),
|
||||||
$c->query('UserId'),
|
$c->query('UserId'),
|
||||||
$c->query('ICacheFactory'),
|
$c->query('ICacheFactory'),
|
||||||
|
@ -48,15 +48,17 @@ class DocumentController extends Controller {
|
|||||||
private $uid;
|
private $uid;
|
||||||
private $l10n;
|
private $l10n;
|
||||||
private $settings;
|
private $settings;
|
||||||
|
private $appConfig;
|
||||||
private $cache;
|
private $cache;
|
||||||
private $logger;
|
private $logger;
|
||||||
const ODT_TEMPLATE_PATH = '/assets/odttemplate.odt';
|
const ODT_TEMPLATE_PATH = '/assets/odttemplate.odt';
|
||||||
|
|
||||||
public function __construct($appName, IRequest $request, IConfig $settings, IL10N $l10n, $uid, ICacheFactory $cache, ILogger $logger){
|
public function __construct($appName, IRequest $request, IConfig $settings, IConfig $appConfig, IL10N $l10n, $uid, ICacheFactory $cache, ILogger $logger){
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
$this->uid = $uid;
|
$this->uid = $uid;
|
||||||
$this->l10n = $l10n;
|
$this->l10n = $l10n;
|
||||||
$this->settings = $settings;
|
$this->settings = $settings;
|
||||||
|
$this->appConfig = $appConfig;
|
||||||
$this->cache = $cache->create($appName);
|
$this->cache = $cache->create($appName);
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
}
|
}
|
||||||
@ -121,7 +123,7 @@ class DocumentController extends Controller {
|
|||||||
private function getDiscovery(){
|
private function getDiscovery(){
|
||||||
\OC::$server->getLogger()->debug('getDiscovery(): Getting discovery.xml from the cache.');
|
\OC::$server->getLogger()->debug('getDiscovery(): Getting discovery.xml from the cache.');
|
||||||
|
|
||||||
$wopiRemote = $this->settings->getAppValue('richdocuments', 'wopi_url');
|
$wopiRemote = $this->appConfig->getAppValue('wopi_url');
|
||||||
|
|
||||||
// Provides access to information about the capabilities of a WOPI client
|
// Provides access to information about the capabilities of a WOPI client
|
||||||
// and the mechanisms for invoking those abilities through URIs.
|
// and the mechanisms for invoking those abilities through URIs.
|
||||||
@ -183,7 +185,7 @@ class DocumentController extends Controller {
|
|||||||
|
|
||||||
if ($discovery_parsed === false) {
|
if ($discovery_parsed === false) {
|
||||||
$this->cache->remove('discovery.xml');
|
$this->cache->remove('discovery.xml');
|
||||||
$wopiRemote = $this->settings->getAppValue('richdocuments', 'wopi_url');
|
$wopiRemote = $this->appConfig->getAppValue('wopi_url');
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'status' => 'error',
|
'status' => 'error',
|
||||||
@ -239,7 +241,7 @@ class DocumentController extends Controller {
|
|||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
*/
|
*/
|
||||||
public function index(){
|
public function index(){
|
||||||
$wopiRemote = $this->settings->getAppValue('richdocuments', 'wopi_url');
|
$wopiRemote = $this->appConfig->getAppValue('wopi_url');
|
||||||
if (($parts = parse_url($wopiRemote)) && isset($parts['scheme']) && isset($parts['host'])) {
|
if (($parts = parse_url($wopiRemote)) && isset($parts['scheme']) && isset($parts['host'])) {
|
||||||
$webSocketProtocol = "ws://";
|
$webSocketProtocol = "ws://";
|
||||||
if ($parts['scheme'] == "https") {
|
if ($parts['scheme'] == "https") {
|
||||||
@ -336,7 +338,7 @@ class DocumentController extends Controller {
|
|||||||
|
|
||||||
if ($discovery_parsed === false) {
|
if ($discovery_parsed === false) {
|
||||||
$this->cache->remove('discovery.xml');
|
$this->cache->remove('discovery.xml');
|
||||||
$wopiRemote = $this->settings->getAppValue('richdocuments', 'wopi_url');
|
$wopiRemote = $this->appConfig->getAppValue('wopi_url');
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'status' => 'error',
|
'status' => 'error',
|
||||||
|
@ -31,6 +31,10 @@ class DocumentControllerTest extends \PHPUnit_Framework_TestCase {
|
|||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock()
|
->getMock()
|
||||||
;
|
;
|
||||||
|
$this->appConfig = $this->getMockBuilder('\OCP\IConfig')
|
||||||
|
->disableOriginalConstructor()
|
||||||
|
->getMock()
|
||||||
|
;
|
||||||
$this->l10n = $this->getMockBuilder('\OCP\IL10N')
|
$this->l10n = $this->getMockBuilder('\OCP\IL10N')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock()
|
->getMock()
|
||||||
@ -47,6 +51,7 @@ class DocumentControllerTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$this->appName,
|
$this->appName,
|
||||||
$this->request,
|
$this->request,
|
||||||
$this->settings,
|
$this->settings,
|
||||||
|
$this->appConfig,
|
||||||
$this->l10n,
|
$this->l10n,
|
||||||
$this->uid,
|
$this->uid,
|
||||||
$this->cache,
|
$this->cache,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user