Code Duplication    Length = 8-8 lines in 2 locations

apps/files/ajax/newfile.php 1 location

@@ 86-93 (lines=8) @@
83
84
$target = $dir.'/'.$filename;
85
86
if (\OC\Files\Filesystem::file_exists($target)) {
87
	$result['data'] = array('message' => (string)$l10n->t(
88
			'The name %s is already used in the folder %s. Please choose a different name.',
89
			array($filename, $dir))
90
		);
91
	OCP\JSON::error($result);
92
	exit();
93
}
94
95
if($source) {
96
	$httpHelper = \OC::$server->getHTTPHelper();

apps/files/ajax/newfolder.php 1 location

@@ 44-51 (lines=8) @@
41
42
$target = $dir . '/' . $foldername;
43
		
44
if (\OC\Files\Filesystem::file_exists($target)) {
45
	$result['data'] = array('message' => $l10n->t(
46
			'The name %s is already used in the folder %s. Please choose a different name.',
47
			array($foldername, $dir))
48
		);
49
	OCP\JSON::error($result);
50
	exit();
51
}
52
53
if(\OC\Files\Filesystem::mkdir($target)) {
54
	if ( $dir !== '/') {