RemoteOperationResult result = null;
MkColMethod mkcol = null;
- boolean noInvalidChars = FileUtils.validatePath(mRemotePath);
+ boolean noInvalidChars = FileUtils.isValidPath(mRemotePath);
if (noInvalidChars) {
try {
mkcol = new MkColMethod(client.getBaseUri() + WebdavUtils.encodePath(mRemotePath));
* @param fileName
* @return
*/
- public static boolean validateName(String fileName) {
+ public static boolean isValidName(String fileName) {
boolean result = true;
Log.d("FileUtils", "fileName =======" + fileName);
* @param path
* @return
*/
- public static boolean validatePath(String path) {
+ public static boolean isValidPath(String path) {
boolean result = true;
Log.d("FileUtils", "path ....... " + path);
<string name="sync_file_fail_msg">Remote file could not be checked</string>
<string name="sync_file_nothing_to_do_msg">File contents already synchronized</string>
<string name="create_dir_fail_msg">Directory could not be created</string>
- <string name="create_dir_fail_msg_invalid_characters">Invalid character in foldername: / \\ < > : " | ? *</string>
+ <string name="filename_forbidden_characters">Forbidden characters: / \\ < > : " | ? *</string>
<string name="wait_a_moment">Wait a moment</string>
<string name="filedisplay_unexpected_bad_get_content">"Unexpected problem ; please select the file from a different app"</string>
<string name="filedisplay_no_file_selected">No file was selected</string>
} else {
dismissLoadingDialog();
if (result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME) {
- Toast.makeText(FileDisplayActivity.this, R.string.create_dir_fail_msg_invalid_characters, Toast.LENGTH_LONG).show();
+ Toast.makeText(FileDisplayActivity.this, R.string.filename_forbidden_characters, Toast.LENGTH_LONG).show();
} else {
try {
Toast msg = Toast.makeText(FileDisplayActivity.this, R.string.create_dir_fail_msg, Toast.LENGTH_LONG);
import android.view.WindowManager.LayoutParams;
import android.widget.EditText;
import android.widget.TextView;
+import android.widget.Toast;
import com.actionbarsherlock.app.SherlockDialogFragment;
import com.owncloud.android.R;
-
+import com.owncloud.android.oc_framework.utils.FileUtils;
/**
switch (which) {
case AlertDialog.BUTTON_POSITIVE: {
mNewFilename = ((TextView)(getDialog().findViewById(R.id.user_input))).getText().toString();
+ if (!FileUtils.isValidName(mNewFilename)) {
+ Toast.makeText(getSherlockActivity(), R.string.filename_forbidden_characters, Toast.LENGTH_LONG).show();
+ return;
+ }
mResult = true;
}
case AlertDialog.BUTTON_NEGATIVE: { // fall through