Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable24] Avoid exception when uploading epub #2779

Merged
merged 1 commit into from Jan 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/Controller/WopiController.php
Expand Up @@ -646,6 +646,11 @@ public function postFile(string $fileId, string $access_token): JSONResponse {
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
// logged in)
list(, $wopiToken) = $this->tokenManager->getToken((string)$file->getId(), null, $wopi->getEditorUid(), $wopi->getDirect());
Expand Down