diff options
author | Carl Schwan <carl@carlschwan.eu> | 2021-12-29 17:44:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-29 17:44:51 +0100 |
commit | 910f05ae2517df8e76152f0dc9df3fbfa68b6ec4 (patch) | |
tree | 48e5764efd726ede331ca6972762f6a4d68b40b9 /apps | |
parent | 8eee11e57eb8b863b74e5ab57ad31752ca9c51cf (diff) | |
parent | 325be6627bf78df347ac3af52a0acabc7415b578 (diff) | |
download | nextcloud-server-910f05ae2517df8e76152f0dc9df3fbfa68b6ec4.tar.gz nextcloud-server-910f05ae2517df8e76152f0dc9df3fbfa68b6ec4.zip |
Merge pull request #30353 from nextcloud/fix/localhost-external-share
Handle external share with invalid host
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/External/Storage.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/files_sharing/lib/External/Storage.php b/apps/files_sharing/lib/External/Storage.php index 7d9e8f31c98..67df60cb55f 100644 --- a/apps/files_sharing/lib/External/Storage.php +++ b/apps/files_sharing/lib/External/Storage.php @@ -44,6 +44,7 @@ use OCP\Files\NotFoundException; use OCP\Files\Storage\IDisableEncryptionStorage; use OCP\Files\StorageInvalidException; use OCP\Files\StorageNotAvailableException; +use OCP\Http\Client\LocalServerException; class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage { /** @var ICloudId */ @@ -314,9 +315,16 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage { $token = $this->getToken(); $password = $this->getPassword(); - // If remote is not an ownCloud do not try to get any share info - if (!$this->remoteIsOwnCloud()) { - return ['status' => 'unsupported']; + try { + // If remote is not an ownCloud do not try to get any share info + if (!$this->remoteIsOwnCloud()) { + return ['status' => 'unsupported']; + } + } catch (LocalServerException $e) { + // throw this to be on the safe side: the share will still be visible + // in the UI in case the failure is intermittent, and the user will + // be able to decide whether to remove it if it's really gone + throw new StorageNotAvailableException(); } $url = rtrim($remote, '/') . '/index.php/apps/files_sharing/shareinfo?t=' . $token; |