Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Fix avatar not found in openproject
- Enhance project search when creating workpackages from Nextcloud
- Drop application's support for Nextcloud 26
- Fix issue preventing direct uploading of resources in Nextcloud that are managed by app `Files Access Control`

## 2.6.4 - 2024-08-15
### Changed
Expand Down
5 changes: 4 additions & 1 deletion lib/Controller/DirectUploadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
use OCP\AppFramework\Http\DataResponse;
use OCP\Files\File;
use OCP\Files\FileInfo;
use OCP\Files\ForbiddenException as FileAccessForbiddenException;
use OCP\Files\InvalidCharacterInPathException;
use OCP\Files\InvalidContentException;
use OCP\Files\InvalidPathException;
Expand Down Expand Up @@ -275,7 +276,9 @@ public function directUpload(string $token):DataResponse {
return new DataResponse([
'error' => $this->l->t($e->getMessage())
], Http::STATUS_BAD_REQUEST);
} catch (ForbiddenException $e) {
} catch (ForbiddenException | FileAccessForbiddenException $e) {
// the FileAccessForbiddenException can occur when we are not allowed to perform certain file operation
// which is controlled by Nextcloud app File Access Control.
return new DataResponse([
'error' => $this->l->t($e->getMessage())
], Http::STATUS_FORBIDDEN);
Expand Down
2 changes: 2 additions & 0 deletions tests/lib/Controller/DirectUploadControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

use OC\Files\View;
use OCP\Files\Folder;
use OCP\Files\ForbiddenException as FileAccessForbiddenException;
use OCP\Files\InvalidContentException;
use OCP\IL10N;
use OCP\IRequest;
Expand Down Expand Up @@ -185,6 +186,7 @@ public function testDirectUploadFileNotUploaded(string $tmpName, int $error):voi
public function newFileExceptionsDataProvider() {
return [
[new InvalidContentException('Virus detected'), 'Virus detected', 415],
[new FileAccessForbiddenException('Access denied by the access control', false), 'Access denied by the access control', 403],
[new \Exception('could not upload'), 'could not upload', 500],
];
}
Expand Down