Code Duplication    Length = 5-6 lines in 2 locations

apps/files_sharing/ajax/shareinfo.php 1 location

@@ 62-66 (lines=5) @@
59
$path = $data['realPath'];
60
61
$isWritable = $linkItem['permissions'] & (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_CREATE);
62
if (!$isWritable) {
63
	\OC\Files\Filesystem::addStorageWrapper('readonly', function ($mountPoint, $storage) {
64
		return new \OC\Files\Storage\Wrapper\PermissionsMask(['storage' => $storage, 'mask' => \OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_SHARE]);
65
	});
66
}
67
68
$rootInfo = \OC\Files\Filesystem::getFileInfo($path);
69
$rootView = new \OC\Files\View('');

lib/private/legacy/util.php 1 location

@@ 164-169 (lines=6) @@
161
		});
162
163
		\OC\Files\Filesystem::addStorageWrapper('enable_sharing', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) {
164
			if (!$mount->getOption('enable_sharing', true)) {
165
				return new \OC\Files\Storage\Wrapper\PermissionsMask([
166
					'storage' => $storage,
167
					'mask' => \OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_SHARE
168
				]);
169
			}
170
			return $storage;
171
		});
172