Skip to content

Commit 777e349

Browse files
committed
chore: Remove deprecated Share_Helper::generateTarget $exclude parameter
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent ed776bb commit 777e349

3 files changed

Lines changed: 7 additions & 16 deletions

File tree

apps/files_sharing/lib/Helper.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,17 @@ public static function registerHooks() {
2222
* check if file name already exists and generate unique target
2323
*
2424
* @param string $path
25-
* @param array $excludeList
2625
* @param View $view
2726
* @return string $path
2827
*/
29-
public static function generateUniqueTarget($path, $excludeList, $view) {
28+
public static function generateUniqueTarget($path, $view) {
3029
$pathinfo = pathinfo($path);
3130
$ext = isset($pathinfo['extension']) ? '.' . $pathinfo['extension'] : '';
3231
$name = $pathinfo['filename'];
3332
$dir = $pathinfo['dirname'];
3433
$i = 2;
35-
while ($view->file_exists($path) || in_array($path, $excludeList)) {
36-
$path = Filesystem::normalizePath($dir . '/' . $name . ' (' . $i . ')' . $ext);
34+
while ($view->file_exists($path)) {
35+
$path = Filesystem::normalizePath($dir . '/' . $name . ' ('.$i.')' . $ext);
3736
$i++;
3837
}
3938

apps/files_sharing/lib/ShareBackend/File.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,12 @@ public function getFilePath($itemSource, $uidOwner) {
6565
*
6666
* @param string $itemSource
6767
* @param string $shareWith
68-
* @param array $exclude (optional)
6968
* @return string
7069
*/
71-
public function generateTarget($itemSource, $shareWith, $exclude = null) {
70+
public function generateTarget($itemSource, $shareWith) {
7271
$shareFolder = \OCA\Files_Sharing\Helper::getShareFolder();
7372
$target = \OC\Files\Filesystem::normalizePath($shareFolder . '/' . basename($itemSource));
7473

75-
// for group shares we return the target right away
76-
if ($shareWith === false) {
77-
return $target;
78-
}
79-
8074
\OC\Files\Filesystem::initMountPoints($shareWith);
8175
$view = new \OC\Files\View('/' . $shareWith . '/files');
8276

@@ -91,9 +85,7 @@ public function generateTarget($itemSource, $shareWith, $exclude = null) {
9185
}
9286
}
9387

94-
$excludeList = is_array($exclude) ? $exclude : [];
95-
96-
return \OCA\Files_Sharing\Helper::generateUniqueTarget($target, $excludeList, $view);
88+
return \OCA\Files_Sharing\Helper::generateUniqueTarget($target, $view);
9789
}
9890

9991
public function formatItems($items, $format, $parameters = null) {

lib/public/Share_Backend.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ public function isValidSource($itemSource, $uidOwner);
3030
* Get a unique name of the item for the specified user
3131
* @param string $itemSource
3232
* @param string|false $shareWith User the item is being shared with
33-
* @param array|null $exclude List of similar item names already existing as shared items @deprecated 7.0.0
3433
* @return string Target name
3534
*
3635
* This function needs to verify that the user does not already have an item with this name.
3736
* If it does generate a new name e.g. name_#
3837
* @since 5.0.0
38+
* @deprecated 31.0.0
3939
*/
40-
public function generateTarget($itemSource, $shareWith, $exclude = null);
40+
public function generateTarget($itemSource, $shareWith);
4141

4242
/**
4343
* Converts the shared item sources back into the item in the specified format

0 commit comments

Comments
 (0)