-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Closed
Copy link
Milestone
Description
Steps to reproduce
- Create a group and assign 2 members (user1 and user2).
- Share a file with user1 to the group.
- Unshare the file with user2.
Expected behaviour
Everything should work perfectly.
Actual behaviour
The file is correctly unshared but after these 3 errors some functions did not work correctly:
{"reqId":"iaLbkobz6NFFnbKTN5ZT","remoteAddr":"10.35.82.142","app":"PHP","message":"Undefined index: shareType at \/var\/www\/nextcloud\/apps\/files_sharing\/lib\/updater.php#172","level":3,"time":"2016-10-11T19:25:29+00:00","method":"DELETE","url":"\/remote.php\/webdav\/test.txt","user":"user2"}
{"reqId":"iaLbkobz6NFFnbKTN5ZT","remoteAddr":"10.35.82.142","app":"PHP","message":"Undefined index: shareWith at \/var\/www\/nextcloud\/apps\/files_sharing\/lib\/updater.php#177","level":3,"time":"2016-10-11T19:25:29+00:00","method":"DELETE","url":"\/remote.php\/webdav\/test.txt","user":"user2"}
{"reqId":"iaLbkobz6NFFnbKTN5ZT","remoteAddr":"10.35.82.142","app":"PHP","message":"Undefined index: fileTarget at \/var\/www\/nextcloud\/apps\/files_sharing\/lib\/updater.php#177","level":3,"time":"2016-10-11T19:25:29+00:00","method":"DELETE","url":"\/remote.php\/webdav\/test.txt","user":"user2"}Server configuration
Operating system: Debian 7 x86_64
Web server: Apache 2.2
Database: Postgresql 9.4
PHP version: 5.4.45-0+deb7u2
ownCloud version: 9.0.1
Updated from an older ownCloud or fresh install: Updated
Logs
ownCloud log (data/owncloud.log)
{"reqId":"iaLbkobz6NFFnbKTN5ZT","remoteAddr":"10.35.82.142","app":"PHP","message":"Undefined index: shareType at \/var\/www\/nextcloud\/apps\/files_sharing\/lib\/updater.php#172","level":3,"time":"2016-10-11T19:25:29+00:00","method":"DELETE","url":"\/remote.php\/webdav\/test.txt","user":"user2"}
{"reqId":"iaLbkobz6NFFnbKTN5ZT","remoteAddr":"10.35.82.142","app":"PHP","message":"Undefined index: shareWith at \/var\/www\/nextcloud\/apps\/files_sharing\/lib\/updater.php#177","level":3,"time":"2016-10-11T19:25:29+00:00","method":"DELETE","url":"\/remote.php\/webdav\/test.txt","user":"user2"}
{"reqId":"iaLbkobz6NFFnbKTN5ZT","remoteAddr":"10.35.82.142","app":"PHP","message":"Undefined index: fileTarget at \/var\/www\/nextcloud\/apps\/files_sharing\/lib\/updater.php#177","level":3,"time":"2016-10-11T19:25:29+00:00","method":"DELETE","url":"\/remote.php\/webdav\/test.txt","user":"user2"}Workaround
This patch could be applied to correct the errors:
--- /var/www/owncloud/apps/files_sharing/lib/updater.php 2016-10-11 17:58:35.121227338 -0300
+++ /var/www/owncloud/apps/files_sharing/lib/updater.php 2016-10-11 18:00:05.449227352 -0300
@@ -168,10 +168,15 @@
static public function postUnshareFromSelfHook($params) {
if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {
foreach ($params['unsharedItems'] as $item) {
- if ($item['shareType'] === \OCP\Share::SHARE_TYPE_GROUP) {
+ if ( isset($item['shareType']) && $item['shareType'] === \OCP\Share::SHARE_TYPE_GROUP) {
foreach (\OC_Group::usersInGroup($item['shareWith']) as $user) {
self::correctUsersFolder($user, $item['fileTarget']);
}
+ }
+ elseif ( isset($item['share_type']) && $item['share_type'] === \OCP\Share::SHARE_TYPE_GROUP) {
+ foreach (\OC_Group::usersInGroup($item['share_with']) as $user) {
+ self::correctUsersFolder($user, $item['file_target']);
+ }
} else {
self::correctUsersFolder($item['shareWith'], $item['fileTarget']);
}Reactions are currently unavailable