Code Duplication    Length = 5-6 lines in 2 locations

apps/files_sharing/ajax/shareinfo.php 1 location

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

lib/private/legacy/util.php 1 location

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