Skip to content
Closed
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
refactor(ShareApiController): Streamline share providers & add error …
…logging

1. Consolidated the repetitive provider code into a clean loop

2. Added exception handling to log unexpected errors

Signed-off-by: nfebe <[email protected]>

[skip ci]
  • Loading branch information
nfebe authored and backportbot[bot] committed Oct 1, 2025
commit 6f30a936aa0f455944d3bbd353f896e51f9ee2a4
11 changes: 8 additions & 3 deletions apps/files_sharing/lib/Controller/ShareAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,14 @@ private function parseDate(string $expireDate): \DateTime {
* @throws ShareNotFound
*/
private function getShareById(string $id): IShare {
$share = null;
$providers = [
'ocinternal' => null, // No type check needed
'ocCircleShare' => IShare::TYPE_CIRCLE,
'ocMailShare' => IShare::TYPE_EMAIL,
'ocRoomShare' => null,
'deck' => IShare::TYPE_DECK,
'sciencemesh' => IShare::TYPE_SCIENCEMESH,
];

// First check if it is an internal share.
try {
Expand All @@ -1701,8 +1708,6 @@ private function getShareById(string $id): IShare {
$share = $this->shareManager->getShareById('ocCircleShare:' . $id, $this->currentUser);
return $share;
}
} catch (ShareNotFound $e) {
// Do nothing, just try the other share type
}

try {
Expand Down