Code Duplication    Length = 5-5 lines in 2 locations

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."));

apps/files/ajax/newfile.php 1 location

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