Code Duplication    Length = 5-5 lines in 2 locations

apps/files_sharing/ajax/publicpreview.php 1 location

@@ 51-55 (lines=5) @@
48
	OCP\JSON::error(array('data' => 'Share is not readable.'));
49
	exit();
50
}
51
if($linkedItem === false || ($linkedItem['item_type'] !== 'file' && $linkedItem['item_type'] !== 'folder')) {
52
	\OC_Response::setStatus(\OC_Response::STATUS_NOT_FOUND);
53
	\OCP\Util::writeLog('core-preview', 'Passed token parameter is not valid', \OCP\Util::DEBUG);
54
	exit;
55
}
56
57
if(!isset($linkedItem['uid_owner']) || !isset($linkedItem['file_source'])) {
58
	\OC_Response::setStatus(\OC_Response::STATUS_INTERNAL_SERVER_ERROR);

apps/files_sharing/lib/helper.php 1 location

@@ 62-66 (lines=5) @@
59
		\OC_User::setIncognitoMode(true);
60
61
		$linkItem = \OCP\Share::getShareByToken($token, !$password);
62
		if($linkItem === false || ($linkItem['item_type'] !== 'file' && $linkItem['item_type'] !== 'folder')) {
63
			\OC_Response::setStatus(404);
64
			\OCP\Util::writeLog('core-preview', 'Passed token parameter is not valid', \OCP\Util::DEBUG);
65
			exit;
66
		}
67
68
		if(!isset($linkItem['uid_owner']) || !isset($linkItem['file_source'])) {
69
			\OC_Response::setStatus(500);