wopi: CheckFileInfo handler added
This commit is contained in:
parent
e059a5f74f
commit
dc05bb09f5
@ -38,6 +38,7 @@ $application->registerRoutes($this, [
|
|||||||
['name' => 'document#localClose', 'url' => 'close/{fileId}', 'verb' => 'POST'],
|
['name' => 'document#localClose', 'url' => 'close/{fileId}', 'verb' => 'POST'],
|
||||||
//documents - for WOPI access
|
//documents - for WOPI access
|
||||||
['name' => 'document#wopiGetToken', 'url' => 'wopi/token/{fileId}', 'verb' => 'GET'],
|
['name' => 'document#wopiGetToken', 'url' => 'wopi/token/{fileId}', 'verb' => 'GET'],
|
||||||
|
['name' => 'document#wopiCheckFileInfo', 'url' => 'wopi/files/{fileId}', 'verb' => 'GET'],
|
||||||
['name' => 'document#wopiGetFile', 'url' => 'wopi/files/{fileId}/contents', 'verb' => 'GET'],
|
['name' => 'document#wopiGetFile', 'url' => 'wopi/files/{fileId}/contents', 'verb' => 'GET'],
|
||||||
['name' => 'document#wopiPutFile', 'url' => 'wopi/files/{fileId}/contents', 'verb' => 'POST'],
|
['name' => 'document#wopiPutFile', 'url' => 'wopi/files/{fileId}/contents', 'verb' => 'POST'],
|
||||||
//settings
|
//settings
|
||||||
|
@ -317,6 +317,38 @@ class DocumentController extends Controller{
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @NoAdminRequired
|
||||||
|
* @NoCSRFRequired
|
||||||
|
* @PublicPage
|
||||||
|
* Returns general info about a file.
|
||||||
|
*/
|
||||||
|
public function wopiCheckFileInfo($fileId){
|
||||||
|
$token = $this->request->getParam('access_token');
|
||||||
|
|
||||||
|
\OC::$server->getLogger()->debug('Getting info about file {fileId} by token {token}.', [ 'app' => $this->appName, 'fileId' => $fileId, 'token' => $token ]);
|
||||||
|
|
||||||
|
$row = new Db\Wopi();
|
||||||
|
$row->loadBy('token', $token);
|
||||||
|
|
||||||
|
$res = $row->getPathForToken($fileId, $token);
|
||||||
|
|
||||||
|
$view = new \OC\Files\View('/' . $res['user'] . '/');
|
||||||
|
$info = $view->getFileInfo($res['path']);
|
||||||
|
|
||||||
|
\OC::$server->getLogger()->debug('File info: {info}.', [ 'app' => $this->appName, 'info' => $info ]);
|
||||||
|
|
||||||
|
$baseFileName = $info['name'];
|
||||||
|
$size = $info['size'];
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'BaseFileName' => $baseFileName,
|
||||||
|
'Size' => $size,
|
||||||
|
//'DownloadUrl' => '',
|
||||||
|
//'FileUrl' => '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
|
Loading…
x
Reference in New Issue
Block a user