Code Duplication    Length = 5-6 lines in 2 locations

apps/files_sharing/ajax/shareinfo.php 1 location

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

lib/private/legacy/util.php 1 location

@@ 156-161 (lines=6) @@
153
		});
154
155
		\OC\Files\Filesystem::addStorageWrapper('enable_sharing', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) {
156
			if (!$mount->getOption('enable_sharing', true)) {
157
				return new \OC\Files\Storage\Wrapper\PermissionsMask([
158
					'storage' => $storage,
159
					'mask' => \OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_SHARE
160
				]);
161
			}
162
			return $storage;
163
		});
164