Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/Service/ApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use OCA\Text\DocumentHasUnsavedChangesException;
use OCA\Text\DocumentSaveConflictException;
use OCA\Text\VersionMismatchException;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\FileDisplayResponse;
use OCP\AppFramework\Http\NotFoundResponse;
Expand Down Expand Up @@ -63,6 +64,17 @@ public function create($fileId = null, $filePath = null, $token = null, $guestNa
/** @var File $file */
if ($token) {
$file = $this->documentService->getFileByShareToken($token, $this->request->getParam('filePath'));

/*
* Check if we have proper read access (files drop)
* If not then well 404 it is.
*/
try {
$this->documentService->checkSharePermissions($token, Constants::PERMISSION_READ);
} catch (NotFoundException $e) {
return new DataResponse([], Http::STATUS_NOT_FOUND);
}

try {
$this->documentService->checkSharePermissions($token, Constants::PERMISSION_UPDATE);
$readOnly = false;
Expand Down