Skip to content

Commit

Permalink
Handle case when share_folder is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed Aug 12, 2022
1 parent 5e9e12e commit 3acb10b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion apps/files_sharing/lib/Controller/Share20OcsController.php
Expand Up @@ -988,7 +988,19 @@ public function updateShare($id) {
* set or deny expiration date if the parent share has applying restrictions.
*/
$uf = $this->getCurrentUserFolder();
$path = $uf->get($share->getTarget());
$target = $share->getTarget();
// Target can be a string that includes the share_folder,
// for example, "/Shares/folder" or "/Shares/document.txt"
// Take the share_folder off the start of target.
$shareFolder = \OC::$server->getConfig()->getSystemValue('share_folder', '/');
if ($shareFolder !== "/") {
$shareFolderNormalized = "/" . \ltrim($shareFolder, "/");
$targetNormalized = "/" . \ltrim($target, "/");
if (\strpos($targetNormalized, $shareFolderNormalized) === 0) {
$target = \substr($targetNormalized, \strlen($shareFolderNormalized));
}
}
$path = $uf->get($target);

if ($path->getStorage()->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) {
$parentStorage = $path->getStorage();
Expand Down

0 comments on commit 3acb10b

Please sign in to comment.