summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_external/lib/Lib/Storage/Swift.php7
-rw-r--r--apps/files_sharing/lib/Controller/ShareesAPIController.php26
-rw-r--r--lib/public/Federation/ICloudIdManager.php1
3 files changed, 23 insertions, 11 deletions
diff --git a/apps/files_external/lib/Lib/Storage/Swift.php b/apps/files_external/lib/Lib/Storage/Swift.php
index 4dc6ff37b19..a775195e85e 100644
--- a/apps/files_external/lib/Lib/Storage/Swift.php
+++ b/apps/files_external/lib/Lib/Storage/Swift.php
@@ -75,11 +75,6 @@ class Swift extends \OC\Files\Storage\Common {
private $id;
/**
- * @var array
- */
- private static $tmpFiles = array();
-
- /**
* Key value cache mapping path to data object. Maps path to
* \OpenCloud\OpenStack\ObjectStorage\Resource\DataObject for existing
* paths and path to false for not existing paths.
@@ -617,7 +612,7 @@ class Swift extends \OC\Files\Storage\Common {
$fileData = fopen($tmpFile, 'r');
$this->getContainer()->uploadObject($path, $fileData);
// invalidate target object to force repopulation on fetch
- $this->objectCache->remove(self::$tmpFiles[$tmpFile]);
+ $this->objectCache->remove($path);
unlink($tmpFile);
}
diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php
index 0e94cfb9d7c..a2ab03bd853 100644
--- a/apps/files_sharing/lib/Controller/ShareesAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php
@@ -336,7 +336,12 @@ class ShareesAPIController extends OCSController {
}
$lowerSearch = strtolower($search);
foreach ($cloudIds as $cloudId) {
- list(, $serverUrl) = $this->splitUserRemote($cloudId);
+ try {
+ list(, $serverUrl) = $this->splitUserRemote($cloudId);
+ } catch (\InvalidArgumentException $e) {
+ continue;
+ }
+
if (strtolower($contact['FN']) === $lowerSearch || strtolower($cloudId) === $lowerSearch) {
if (strtolower($cloudId) === $lowerSearch) {
$result['exactIdMatch'] = true;
@@ -387,14 +392,14 @@ class ShareesAPIController extends OCSController {
*
* @param string $address federated share address
* @return array [user, remoteURL]
- * @throws \Exception
+ * @throws \InvalidArgumentException
*/
public function splitUserRemote($address) {
try {
$cloudId = $this->cloudIdManager->resolveCloudId($address);
return [$cloudId->getUser(), $cloudId->getRemote()];
} catch (\InvalidArgumentException $e) {
- throw new \Exception('Invalid Federated Cloud ID', 0, $e);
+ throw new \InvalidArgumentException('Invalid Federated Cloud ID', 0, $e);
}
}
@@ -611,7 +616,12 @@ class ShareesAPIController extends OCSController {
if (isset($contact['isLocalSystemBook'])) {
if ($exactEmailMatch) {
- $cloud = $this->cloudIdManager->resolveCloudId($contact['CLOUD'][0]);
+ try {
+ $cloud = $this->cloudIdManager->resolveCloudId($contact['CLOUD'][0]);
+ } catch (\InvalidArgumentException $e) {
+ continue;
+ }
+
if (!$this->hasUserInResult($cloud->getUser())) {
$this->result['exact']['users'][] = [
'label' => $contact['FN'] . " ($emailAddress)",
@@ -623,8 +633,14 @@ class ShareesAPIController extends OCSController {
}
return ['results' => [], 'exact' => [], 'exactIdMatch' => true];
}
+
if ($this->shareeEnumeration) {
- $cloud = $this->cloudIdManager->resolveCloudId($contact['CLOUD'][0]);
+ try {
+ $cloud = $this->cloudIdManager->resolveCloudId($contact['CLOUD'][0]);
+ } catch (\InvalidArgumentException $e) {
+ continue;
+ }
+
if (!$this->hasUserInResult($cloud->getUser())) {
$this->result['users'][] = [
'label' => $contact['FN'] . " ($emailAddress)",
diff --git a/lib/public/Federation/ICloudIdManager.php b/lib/public/Federation/ICloudIdManager.php
index 7be8f08c6b7..5251c2b95db 100644
--- a/lib/public/Federation/ICloudIdManager.php
+++ b/lib/public/Federation/ICloudIdManager.php
@@ -29,6 +29,7 @@ interface ICloudIdManager {
/**
* @param string $cloudId
* @return ICloudId
+ * @throws \InvalidArgumentException
*
* @since 12.0.0
*/