diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index c5b5060893a6961670855bdff44824cd56d99741..f8c241425d3df1f0a8fa2c00079b0c9e4fbccad1 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -442,6 +442,37 @@ class Shared extends \OC\Files\Storage\Common {
 		}
 	}
 
+	/**
+	 * update fileTarget in the database if the mount point changed
+	 * @param string $newPath
+	 * @param array $share reference to the share which should be modified
+	 * @return type
+	 */
+	private static function updateFileTarget($newPath, &$share) {
+		// if the user renames a mount point from a group share we need to create a new db entry
+		// for the unique name
+		if ($share['share_type'] === \OCP\Share::SHARE_TYPE_GROUP && $this->uniqueNameSet() === false) {
+			$query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (`item_type`, `item_source`, `item_target`,'
+			.' `share_type`, `share_with`, `uid_owner`, `permissions`, `stime`, `file_source`,'
+			.' `file_target`, `token`, `parent`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)');
+			$arguments = array($share['item_type'], $share['item_source'], $share['item_target'],
+				2, \OCP\User::getUser(), $share['uid_owner'], $share['permissions'], $share['stime'], $share['file_source'],
+				$newPath, $share['token'], $share['id']);
+
+			$this->setUniqueName();
+		} else {
+			// rename mount point
+			$query = \OC_DB::prepare(
+					'Update `*PREFIX*share`
+						SET `file_target` = ?
+						WHERE `id` = ?'
+					);
+			$arguments = array($newPath, $share['id']);
+		}
+
+		return $query->execute($arguments);
+	}
+
 	/**
 	 * return mount point of share, relative to data/user/files
 	 *