<commit_before><?php

// Init owncloud


OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();

// Get data
$dir = stripslashes($_GET["dir"]);
$file = stripslashes($_GET["file"]);
$newname = stripslashes($_GET["newname"]);

$l = OC_L10N::get('files');

if ( $newname !== '.' and ($dir != '' || $file != 'Shared') and $newname !== 'Shared' ) {
	$targetFile = \OC\Files\Filesystem::normalizePath($dir . '/' . $newname);
	$sourceFile = \OC\Files\Filesystem::normalizePath($dir . '/' . $file);
	if(\OC\Files\Filesystem::rename($sourceFile, $targetFile)) {
		OCP\JSON::success(array("data" => array( "dir" => $dir, "file" => $file, "newname" => $newname )));
	} else {
		OCP\JSON::error(array("data" => array( "message" => $l->t("Unable to rename file") )));
	}
} elseif( $newname === 'Shared' ) {
	OCP\JSON::error(array("data" => array( "message" => $l->t("Invalid folder name. Usage of 'Shared' is reserved by Owncloud") )));
} else {
	OCP\JSON::error(array("data" => array( "message" => $l->t("Unable to rename file") )));
}<commit_msg>wrong root dir name<commit_after><?php

// Init owncloud


OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();

// Get data
$dir = stripslashes($_GET["dir"]);
$file = stripslashes($_GET["file"]);
$newname = stripslashes($_GET["newname"]);

$l = OC_L10N::get('files');

if ( $newname !== '.' and ($dir != '/' || $file != 'Shared') and ($dir !== '/' || $newname !== 'Shared') ) {
	$targetFile = \OC\Files\Filesystem::normalizePath($dir . '/' . $newname);
	$sourceFile = \OC\Files\Filesystem::normalizePath($dir . '/' . $file);
	if(\OC\Files\Filesystem::rename($sourceFile, $targetFile)) {
		OCP\JSON::success(array("data" => array( "dir" => $dir, "file" => $file, "newname" => $newname )));
	} else {
		OCP\JSON::error(array("data" => array( "message" => $l->t("Unable to rename file") )));
	}
} elseif( $dir === '/' and $newname === 'Shared' ) {
	OCP\JSON::error(array("data" => array( "message" => $l->t("Invalid folder name. Usage of 'Shared' is reserved by Owncloud") )));
} else {
	OCP\JSON::error(array("data" => array( "message" => $l->t("Unable to rename file") )));
}
{'fraction_non_alphanumeric': 0.25832540437678403, 'fraction_numerical': 0.0019029495718363464, 'mean_word_length': 5.025787965616046, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4090092', 'n_tokens_mistral': 792, 'n_tokens_neox': 789, 'n_words': 150}