aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/Controller/ShareAPIController.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/lib/Controller/ShareAPIController.php')
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php19
1 files changed, 10 insertions, 9 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index 266c1f9474c..7de1376b951 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -190,7 +190,7 @@ class ShareAPIController extends OCSController {
if ($isOwnShare) {
$result['item_permissions'] = $node->getPermissions();
}
-
+
// If we're on the recipient side, the node permissions
// are bound to the share permissions. So we need to
// adjust the permissions to the share permissions if necessary.
@@ -675,7 +675,7 @@ class ShareAPIController extends OCSController {
$expireDateTime = $this->parseDate($expireDate);
$share->setExpirationDate($expireDateTime);
} catch (\Exception $e) {
- throw new OCSNotFoundException($this->l->t('Invalid date, date format must be YYYY-MM-DD'));
+ throw new OCSNotFoundException($e->getMessage(), $e);
}
} else {
// Client sent empty string for expire date.
@@ -826,12 +826,11 @@ class ShareAPIController extends OCSController {
try {
$share = $this->shareManager->createShare($share);
} catch (GenericShareException $e) {
- \OC::$server->getLogger()->logException($e);
$code = $e->getCode() === 0 ? 403 : $e->getCode();
throw new OCSException($e->getHint(), $code);
} catch (\Exception $e) {
- \OC::$server->getLogger()->logException($e);
- throw new OCSForbiddenException($e->getMessage(), $e);
+ $this->logger->error($e->getMessage(), ['exception' => $e]);
+ throw new OCSForbiddenException('Failed to create share.', $e);
}
$output = $this->formatShare($share);
@@ -1352,11 +1351,11 @@ class ShareAPIController extends OCSController {
$share->setExpirationDate(null);
} elseif ($expireDate !== null) {
try {
- $expireDate = $this->parseDate($expireDate);
+ $expireDateTime = $this->parseDate($expireDate);
+ $share->setExpirationDate($expireDateTime);
} catch (\Exception $e) {
throw new OCSBadRequestException($e->getMessage(), $e);
}
- $share->setExpirationDate($expireDate);
}
try {
@@ -1365,7 +1364,8 @@ class ShareAPIController extends OCSController {
$code = $e->getCode() === 0 ? 403 : $e->getCode();
throw new OCSException($e->getHint(), (int)$code);
} catch (\Exception $e) {
- throw new OCSBadRequestException($e->getMessage(), $e);
+ $this->logger->error($e->getMessage(), ['exception' => $e]);
+ throw new OCSBadRequestException('Failed to update share.', $e);
}
return new DataResponse($this->formatShare($share));
@@ -1456,7 +1456,8 @@ class ShareAPIController extends OCSController {
$code = $e->getCode() === 0 ? 403 : $e->getCode();
throw new OCSException($e->getHint(), (int)$code);
} catch (\Exception $e) {
- throw new OCSBadRequestException($e->getMessage(), $e);
+ $this->logger->error($e->getMessage(), ['exception' => $e]);
+ throw new OCSBadRequestException('Failed to accept share.', $e);
}
return new DataResponse();