Code Duplication    Length = 4-5 lines in 3 locations

apps/files/ajax/newfile.php 1 location

@@ 69-73 (lines=5) @@
66
	exit();
67
}
68
69
if(!OCP\Util::isValidFileName($filename)) {
70
	$result['data'] = array('message' => (string)$l10n->t("Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed."));
71
	OCP\JSON::error($result);
72
	exit();
73
}
74
75
if (!\OC\Files\Filesystem::file_exists($dir . '/')) {
76
	$result['data'] = array('message' => (string)$l10n->t(

apps/files/ajax/newfolder.php 1 location

@@ 27-31 (lines=5) @@
24
	exit();
25
}
26
27
if(!OCP\Util::isValidFileName($foldername)) {
28
	$result['data'] = array('message' => (string)$l10n->t("Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed."));
29
	OCP\JSON::error($result);
30
	exit();
31
}
32
33
if (!\OC\Files\Filesystem::file_exists($dir . '/')) {
34
	$result['data'] = array('message' => (string)$l10n->t(

apps/files_sharing/ajax/external.php 1 location

@@ 29-32 (lines=4) @@
26
$password = $_POST['password'];
27
28
// Check for invalid name
29
if(!\OCP\Util::isValidFileName($name)) {
30
	\OCP\JSON::error(array('data' => array('message' => $l->t('The mountpoint name contains invalid characters.'))));
31
	exit();
32
}
33
34
$currentUser = \OC::$server->getUserSession()->getUser()->getUID();
35
$currentServer = \OC::$server->getURLGenerator()->getAbsoluteURL('/');