|
5 | 5 | * SPDX-FileCopyrightText: 2016 ownCloud, Inc. |
6 | 6 | * SPDX-License-Identifier: AGPL-3.0-only |
7 | 7 | */ |
| 8 | + |
8 | 9 | namespace OC\Share20; |
9 | 10 |
|
| 11 | +use OC\User\NoUserException; |
10 | 12 | use OCP\Constants; |
11 | 13 | use OCP\Files\Cache\ICacheEntry; |
12 | 14 | use OCP\Files\File; |
@@ -158,20 +160,24 @@ public function getNode() { |
158 | 160 | throw new NotFoundException(); |
159 | 161 | } |
160 | 162 |
|
161 | | - // for federated shares the owner can be a remote user, in this |
162 | | - // case we use the initiator |
163 | | - if ($this->userManager->userExists($this->shareOwner)) { |
164 | | - $userFolder = $this->rootFolder->getUserFolder($this->shareOwner); |
165 | | - } else { |
166 | | - $userFolder = $this->rootFolder->getUserFolder($this->sharedBy); |
| 163 | + try { |
| 164 | + // for federated shares the owner can be a remote user, in this |
| 165 | + // case we use the initiator |
| 166 | + if ($this->userManager->userExists($this->shareOwner)) { |
| 167 | + $userFolder = $this->rootFolder->getUserFolder($this->shareOwner); |
| 168 | + } else { |
| 169 | + $userFolder = $this->rootFolder->getUserFolder($this->sharedBy); |
| 170 | + } |
| 171 | + |
| 172 | + $node = $userFolder->getFirstNodeById($this->fileId); |
| 173 | + if (!$node) { |
| 174 | + throw new NotFoundException('Node for share not found, fileid: ' . $this->fileId); |
| 175 | + } |
| 176 | + |
| 177 | + $this->node = $node; |
| 178 | + } catch (NoUserException $e) { |
| 179 | + throw new NotFoundException('Owner for share not found, fileid: ' . $this->fileId, previous:$e); |
167 | 180 | } |
168 | | - |
169 | | - $node = $userFolder->getFirstNodeById($this->fileId); |
170 | | - if (!$node) { |
171 | | - throw new NotFoundException('Node for share not found, fileid: ' . $this->fileId); |
172 | | - } |
173 | | - |
174 | | - $this->node = $node; |
175 | 181 | } |
176 | 182 |
|
177 | 183 | return $this->node; |
|
0 commit comments