]> source.dussan.org Git - nextcloud-server.git/commitdiff
Do not only catch Exceptions but any Throwable during rmt share delete 21201/head
authorChristoph Wurst <christoph@winzerhof-wurst.at>
Tue, 2 Jun 2020 07:21:09 +0000 (09:21 +0200)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Wed, 3 Jun 2020 09:15:55 +0000 (09:15 +0000)
When a remote share is deleted, we notify the remove instance. This may
trigger various error conditions, which we want to catch in order to
avoid undeletable shares. The try-catch, however, did only capture
exceptions, so things like TypeErrors were not caught and caused the
process to fail hard.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
apps/files_sharing/lib/External/Manager.php

index c58e6e7b98a78b859cda836df3ee3fdfd9ae68dc..14c1eaa33c2c3106c56314484168c4279246b91f 100644 (file)
@@ -526,7 +526,7 @@ class Manager {
                if ($result && $share !== false && (int)$share['share_type'] === Share::SHARE_TYPE_USER) {
                        try {
                                $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline');
-                       } catch (\Exception $e) {
+                       } catch (\Throwable $e) {
                                // if we fail to notify the remote (probably cause the remote is down)
                                // we still want the share to be gone to prevent undeletable remotes
                        }
@@ -636,7 +636,7 @@ class Manager {
                }
 
                $query = 'SELECT `id`, `remote`, `remote_id`, `share_token`, `name`, `owner`, `user`, `mountpoint`, `accepted`
-                         FROM `*PREFIX*share_external` 
+                         FROM `*PREFIX*share_external`
                                  WHERE (`user` = ? OR `user` IN (?))';
                $parameters = [$this->uid, implode(',',$userGroups)];
                if (!is_null($accepted)) {