Merge pull request #2767 from eszkadev/fix-epub-upload

Avoid exception when uploading epub
This commit is contained in:
Julius Härtl 2023-01-25 16:18:51 +01:00 коммит произвёл GitHub
Родитель f88a92bdc2 db1582f937
Коммит 176b2b71fc
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -675,6 +675,11 @@ class WopiController extends Controller {
return new JSONResponse(['message' => 'File locked'], Http::STATUS_INTERNAL_SERVER_ERROR); return new JSONResponse(['message' => 'File locked'], Http::STATUS_INTERNAL_SERVER_ERROR);
} }
// epub is exception (can be uploaded but not opened so don't try to get access token)
if ($file->getMimeType() == 'application/epub+zip') {
return new JSONResponse([ 'Name' => $file->getName() ], Http::STATUS_OK);
}
// generate a token for the new file (the user still has to be // generate a token for the new file (the user still has to be
// logged in) // logged in)
list(, $wopiToken) = $this->tokenManager->getToken((string)$file->getId(), null, $wopi->getEditorUid(), $wopi->getDirect()); list(, $wopiToken) = $this->tokenManager->getToken((string)$file->getId(), null, $wopi->getEditorUid(), $wopi->getDirect());