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

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