Code Duplication    Length = 4-5 lines in 3 locations

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/ajax/newfile.php 1 location

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

apps/files_sharing/ajax/external.php 1 location

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