Code Duplication    Length = 5-5 lines in 2 locations

apps/files/ajax/newfile.php 1 location

@@ 58-62 (lines=5) @@
55
);
56
$trimmedFileName = trim($filename);
57
58
if($trimmedFileName === '') {
59
	$result['data'] = array('message' => (string)$l10n->t('File name cannot be empty.'));
60
	OCP\JSON::error($result);
61
	exit();
62
}
63
if($trimmedFileName === '.' || $trimmedFileName === '..') {
64
	$result['data'] = array('message' => (string)$l10n->t('"%s" is an invalid file name.', $trimmedFileName));
65
	OCP\JSON::error($result);

apps/files/ajax/newfolder.php 1 location

@@ 21-25 (lines=5) @@
18
	'data'		=> NULL
19
	);
20
21
if(trim($foldername) === '') {
22
	$result['data'] = array('message' => $l10n->t('Folder name cannot be empty.'));
23
	OCP\JSON::error($result);
24
	exit();
25
}
26
27
if(!OCP\Util::isValidFileName($foldername)) {
28
	$result['data'] = array('message' => (string)$l10n->t("Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed."));