diff options
author | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-07-20 16:41:39 -0400 |
---|---|---|
committer | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-07-20 16:41:39 -0400 |
commit | fcda3a338c1a2cc08337dcc594a3f67bc4e8d879 (patch) | |
tree | 03a4b3be6a50b6767b8c56a47f1bddf186e8aa35 | |
parent | 3e6037659e222f584e8165a5a5c860ef88991f71 (diff) | |
download | nextcloud-server-fcda3a338c1a2cc08337dcc594a3f67bc4e8d879.tar.gz nextcloud-server-fcda3a338c1a2cc08337dcc594a3f67bc4e8d879.zip |
Fix bug in constructor for appending numbers to already existing targets
-rw-r--r-- | apps/files_sharing/lib_share.php | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php index 848c44788a8..ae730a21a5e 100644 --- a/apps/files_sharing/lib_share.php +++ b/apps/files_sharing/lib_share.php @@ -47,16 +47,18 @@ class OC_SHARE { $target = "/".$uid."/files/Share/".basename($source); $check = OC_DB::prepare("SELECT target FROM *PREFIX*sharing WHERE target = ? AND uid_shared_with = ?"); $result = $check->execute(array($target, $uid))->fetchAll(); + // Check if target already exists for the user, if it does append a number to the name if (count($result) > 0) { if ($pos = strrpos($target, ".")) { $name = substr($target, 0, $pos); $ext = substr($target, $pos); } else { $name = $target; + $ext = ""; } $counter = 1; while (count($result) > 0) { - $newTarget = $name."_".$counter.isset($ext); + $newTarget = $name."_".$counter.$ext; $result = $check->execute(array($newTarget, $uid))->fetchAll(); $counter++; } |