Do not generate tokens for editor IDs that do not exist

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2019-12-19 09:38:22 +01:00
parent 8cd86f110b
commit 4ff11e3955
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
1 changed files with 5 additions and 0 deletions

View File

@ -45,6 +45,8 @@ use OCP\IUserSession;
use OCP\L10N\IFactory;
use OCP\Security\ISecureRandom;
use OCP\Share\IShare;
use function array_key_exists;
use function in_array;
class Manager implements IManager {
@ -140,6 +142,9 @@ class Manager implements IManager {
if ($editorId === null) {
$editorId = $this->findEditorForFile($file);
}
if (!array_key_exists($editorId, $this->editors)) {
throw new \RuntimeException("Editor $editorId is unknown");
}
return $this->createToken($editorId, $file, $filePath);
}