From: David A. Velasco Date: Tue, 19 Nov 2013 10:25:30 +0000 (+0100) Subject: Merge branch 'develop' into refactor_remote_operation_to_rename_folder X-Git-Tag: oc-android-1.5.5~123^2~2 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/f6ac875ce56f67ee30d8894674f26fcbf08317e6?hp=d82d6a6d043d157f4ae5e3f3d7dd8d2898fb6bb6 Merge branch 'develop' into refactor_remote_operation_to_rename_folder --- diff --git a/oc_framework-test-project/oc_framework-test-test/src/com/owncloud/android/oc_framework_test_project/test/CreateFolderTest.java b/oc_framework-test-project/oc_framework-test-test/src/com/owncloud/android/oc_framework_test_project/test/CreateFolderTest.java index 0c4b8efa..84145022 100644 --- a/oc_framework-test-project/oc_framework-test-test/src/com/owncloud/android/oc_framework_test_project/test/CreateFolderTest.java +++ b/oc_framework-test-project/oc_framework-test-test/src/com/owncloud/android/oc_framework_test_project/test/CreateFolderTest.java @@ -54,7 +54,7 @@ public class CreateFolderTest extends ActivityInstrumentationTestCase2 : " | ? * */ public void testCreateFolderSpecialCharacters() { boolean createFullPath = true; diff --git a/oc_framework-test-project/oc_framework-test-test/src/com/owncloud/android/oc_framework_test_project/test/RenameFileTest.java b/oc_framework-test-project/oc_framework-test-test/src/com/owncloud/android/oc_framework_test_project/test/RenameFileTest.java new file mode 100644 index 00000000..fe30550b --- /dev/null +++ b/oc_framework-test-project/oc_framework-test-test/src/com/owncloud/android/oc_framework_test_project/test/RenameFileTest.java @@ -0,0 +1,147 @@ +package com.owncloud.android.oc_framework_test_project.test; + +import com.owncloud.android.oc_framework.operations.RemoteOperationResult; +import com.owncloud.android.oc_framework.operations.RemoteOperationResult.ResultCode; +import com.owncloud.android.oc_framework_test_project.TestActivity; + +import android.test.ActivityInstrumentationTestCase2; + +public class RenameFileTest extends ActivityInstrumentationTestCase2 { + + /* Folder data to rename. This folder must exist on the account */ + private final String mOldFolderName = "folderToRename"; + private final String mOldFolderPath = "/folderToRename"; + private final String mNewFolderName = "renamedFolder"; + private final String mNewFolderPath = "/renamedFolder"; + + /* File data to rename. This file must exist on the account */ + private final String mOldFileName = "fileToRename.png"; + private final String mOldFilePath = "/fileToRename.png"; + private final String mNewFileName = "renamedFile"; + private final String mFileExtension = ".png"; + private final String mNewFilePath ="/renamedFile.png"; + + + private TestActivity mActivity; + + public RenameFileTest() { + super(TestActivity.class); + + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + setActivityInitialTouchMode(false); + mActivity = getActivity(); + } + + /** + * Test Rename Folder + */ + public void testRenameFolder() { + + RemoteOperationResult result = mActivity.renameFile(mOldFolderName, mOldFolderPath, + mNewFolderName, true); + assertTrue(result.isSuccess()); + } + + /** + * Test Rename Folder with forbidden characters : \ < > : " | ? * + */ + public void testRenameFolderForbiddenChars() { + + RemoteOperationResult result = mActivity.renameFile(mOldFolderName, mOldFolderPath, + mNewFolderName + "\\", true); + assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); + + result = mActivity.renameFile(mOldFolderName, mOldFolderPath, + mNewFolderName + "<", true); + assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); + + result = mActivity.renameFile(mOldFolderName, mOldFolderPath, + mNewFolderName + ">", true); + assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); + + result = mActivity.renameFile(mOldFolderName, mOldFolderPath, + mNewFolderName + ":", true); + assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); + + result = mActivity.renameFile(mOldFolderName, mOldFolderPath, + mNewFolderName + "\"", true); + assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); + + result = mActivity.renameFile(mOldFolderName, mOldFolderPath, + mNewFolderName + "|", true); + assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); + + result = mActivity.renameFile(mOldFolderName, mOldFolderPath, + mNewFolderName + "?", true); + assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); + + result = mActivity.renameFile(mOldFolderName, mOldFolderPath, + mNewFolderName + "*", true); + assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); + } + + /** + * Test Rename File + */ + public void testRenameFile() { + RemoteOperationResult result = mActivity.renameFile(mOldFileName, mOldFilePath, + mNewFileName + mFileExtension, false); + assertTrue(result.isSuccess()); + } + + + /** + * Test Rename Folder with forbidden characters: \ < > : " | ? * + */ + public void testRenameFileForbiddenChars() { + RemoteOperationResult result = mActivity.renameFile(mOldFileName, mOldFilePath, + mNewFileName + "\\" + mFileExtension, false); + assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); + + result = mActivity.renameFile(mOldFileName, mOldFilePath, + mNewFileName + "<" + mFileExtension, false); + assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); + + result = mActivity.renameFile(mOldFileName, mOldFilePath, + mNewFileName + ">" + mFileExtension, false); + assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); + + result = mActivity.renameFile(mOldFileName, mOldFilePath, + mNewFileName + ":" + mFileExtension, false); + assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); + + result = mActivity.renameFile(mOldFileName, mOldFilePath, + mNewFileName + "\"" + mFileExtension, false); + assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); + + result = mActivity.renameFile(mOldFileName, mOldFilePath, + mNewFileName + "|" + mFileExtension, false); + assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); + + result = mActivity.renameFile(mOldFileName, mOldFilePath, + mNewFileName + "?" + mFileExtension, false); + assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); + + result = mActivity.renameFile(mOldFileName, mOldFilePath, + mNewFileName + "*" + mFileExtension, false); + assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); + + } + + + /** + * Restore initial conditions + */ + public void testRestoreInitialConditions() { + RemoteOperationResult result = mActivity.renameFile(mNewFolderName, mNewFolderPath, mOldFolderName, true); + assertTrue(result.isSuccess()); + + result = mActivity.renameFile(mNewFileName + mFileExtension, mNewFilePath, mOldFileName, false); + assertTrue(result.isSuccess()); + } + +} diff --git a/oc_framework-test-project/src/com/owncloud/android/oc_framework_test_project/TestActivity.java b/oc_framework-test-project/src/com/owncloud/android/oc_framework_test_project/TestActivity.java index e1c1edcb..7fdf9cd4 100644 --- a/oc_framework-test-project/src/com/owncloud/android/oc_framework_test_project/TestActivity.java +++ b/oc_framework-test-project/src/com/owncloud/android/oc_framework_test_project/TestActivity.java @@ -7,6 +7,7 @@ import com.owncloud.android.oc_framework.network.webdav.OwnCloudClientFactory; import com.owncloud.android.oc_framework.network.webdav.WebdavClient; import com.owncloud.android.oc_framework.operations.RemoteOperationResult; import com.owncloud.android.oc_framework.operations.remote.CreateRemoteFolderOperation; +import com.owncloud.android.oc_framework.operations.remote.RenameRemoteFileOperation; import android.os.AsyncTask; import android.os.Bundle; @@ -28,6 +29,13 @@ public class TestActivity extends Activity { private static final String TAG = "TestActivity"; + // This account must exists on the simulator / device + private static final String mAccountHost = "beta.owncloud.com"; + private static final String mAccountUser = "testandroid"; + private static final String mAccountName = mAccountUser + "@"+ mAccountHost; + private static final String mAccountPass = "testandroid"; + private static final String mAccountType = "owncloud"; + private Account mAccount = null; private WebdavClient mClient; @@ -35,19 +43,12 @@ public class TestActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_test); - - // This account must exists on the simulator / device - String accountHost = "beta.owncloud.com"; - String accountUser = "testandroid"; - String accountName = accountUser + "@"+ accountHost; - String accountPass = "testandroid"; - String accountType = "owncloud"; AccountManager am = AccountManager.get(this); - Account[] ocAccounts = am.getAccountsByType(accountType); + Account[] ocAccounts = am.getAccountsByType(mAccountType); for (Account ac : ocAccounts) { - if (ac.name.equals(accountName)) { + if (ac.name.equals(mAccountName)) { mAccount = ac; break; } @@ -70,6 +71,7 @@ public class TestActivity extends Activity { * Access to the library method to Create a Folder * @param remotePath * @param createFullPath + * * @return */ public RemoteOperationResult createFolder(String remotePath, boolean createFullPath) { @@ -80,6 +82,24 @@ public class TestActivity extends Activity { return result; } + /** + * Access to the library method to Rename a File or Folder + * @param oldName Old name of the file. + * @param oldRemotePath Old remote path of the file. For folders it starts and ends by "/" + * @param newName New name to set as the name of file. + * @param isFolder 'true' for folder and 'false' for files + * + * @return + */ + + public RemoteOperationResult renameFile(String oldName, String oldRemotePath, String newName, boolean isFolder) { + + RenameRemoteFileOperation renameOperation = new RenameRemoteFileOperation(oldName, oldRemotePath, newName, isFolder); + RemoteOperationResult result = renameOperation.execute(mClient); + + return result; + } + private class AuthTask extends AsyncTask { @Override diff --git a/oc_framework/src/com/owncloud/android/oc_framework/network/webdav/OwnCloudClientFactory.java b/oc_framework/src/com/owncloud/android/oc_framework/network/webdav/OwnCloudClientFactory.java index 5c41edb0..0c0c2072 100644 --- a/oc_framework/src/com/owncloud/android/oc_framework/network/webdav/OwnCloudClientFactory.java +++ b/oc_framework/src/com/owncloud/android/oc_framework/network/webdav/OwnCloudClientFactory.java @@ -78,8 +78,8 @@ public class OwnCloudClientFactory { } else { String username = account.name.substring(0, account.name.lastIndexOf('@')); - //String password = am.getPassword(account); - String password = am.blockingGetAuthToken(account, AccountTypeUtils.getAuthTokenTypePass(account.type), false); + String password = am.getPassword(account); + //String password = am.blockingGetAuthToken(account, AccountTypeUtils.getAuthTokenTypePass(account.type), false); client.setBasicCredentials(username, password); } diff --git a/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/RenameRemoteFileOperation.java b/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/RenameRemoteFileOperation.java new file mode 100644 index 00000000..ad6fffc8 --- /dev/null +++ b/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/RenameRemoteFileOperation.java @@ -0,0 +1,129 @@ +package com.owncloud.android.oc_framework.operations.remote; + +import java.io.File; + +import org.apache.jackrabbit.webdav.client.methods.DavMethodBase; + +import android.util.Log; + +import com.owncloud.android.oc_framework.network.webdav.WebdavClient; +import com.owncloud.android.oc_framework.network.webdav.WebdavUtils; +import com.owncloud.android.oc_framework.operations.RemoteOperation; +import com.owncloud.android.oc_framework.operations.RemoteOperationResult; +import com.owncloud.android.oc_framework.operations.RemoteOperationResult.ResultCode; +import com.owncloud.android.oc_framework.utils.FileUtils; + + +/** + * Remote operation performing the rename of a remote file or folder in the ownCloud server. + * + * @author David A. Velasco + * @author masensio + */ +public class RenameRemoteFileOperation extends RemoteOperation { + + private static final String TAG = RenameRemoteFileOperation.class.getSimpleName(); + + private static final int RENAME_READ_TIMEOUT = 10000; + private static final int RENAME_CONNECTION_TIMEOUT = 5000; + + private String mOldName; + private String mOldRemotePath; + private String mNewName; + private String mNewRemotePath; + + + /** + * Constructor + * + * @param oldName Old name of the file. + * @param oldRemotePath Old remote path of the file. + * @param newName New name to set as the name of file. + * @param isFolder 'true' for folder and 'false' for files + */ + public RenameRemoteFileOperation(String oldName, String oldRemotePath, String newName, boolean isFolder) { + mOldName = oldName; + mOldRemotePath = oldRemotePath; + mNewName = newName; + + String parent = (new File(mOldRemotePath)).getParent(); + parent = (parent.endsWith(FileUtils.PATH_SEPARATOR)) ? parent : parent + FileUtils.PATH_SEPARATOR; + mNewRemotePath = parent + mNewName; + if (isFolder) { + mNewRemotePath += FileUtils.PATH_SEPARATOR; + } + } + + /** + * Performs the rename operation. + * + * @param client Client object to communicate with the remote ownCloud server. + */ + @Override + protected RemoteOperationResult run(WebdavClient client) { + RemoteOperationResult result = null; + + LocalMoveMethod move = null; + + boolean noInvalidChars = FileUtils.isValidPath(mNewRemotePath); + + if (noInvalidChars) { + try { + + if (mNewName.equals(mOldName)) { + return new RemoteOperationResult(ResultCode.OK); + } + + + // check if a file with the new name already exists + if (client.existsFile(mNewRemotePath)) { + return new RemoteOperationResult(ResultCode.INVALID_OVERWRITE); + } + + move = new LocalMoveMethod( client.getBaseUri() + WebdavUtils.encodePath(mOldRemotePath), + client.getBaseUri() + WebdavUtils.encodePath(mNewRemotePath)); + int status = client.executeMethod(move, RENAME_READ_TIMEOUT, RENAME_CONNECTION_TIMEOUT); + + move.getResponseBodyAsString(); // exhaust response, although not interesting + result = new RemoteOperationResult(move.succeeded(), status, move.getResponseHeaders()); + Log.i(TAG, "Rename " + mOldRemotePath + " to " + mNewRemotePath + ": " + result.getLogMessage()); + + } catch (Exception e) { + result = new RemoteOperationResult(e); + Log.e(TAG, "Rename " + mOldRemotePath + " to " + ((mNewRemotePath==null) ? mNewName : mNewRemotePath) + ": " + result.getLogMessage(), e); + + } finally { + if (move != null) + move.releaseConnection(); + } + } else { + result = new RemoteOperationResult(ResultCode.INVALID_CHARACTER_IN_NAME); + } + + return result; + } + + /** + * Move operation + * + */ + private class LocalMoveMethod extends DavMethodBase { + + public LocalMoveMethod(String uri, String dest) { + super(uri); + addRequestHeader(new org.apache.commons.httpclient.Header("Destination", dest)); + } + + @Override + public String getName() { + return "MOVE"; + } + + @Override + protected boolean isSuccess(int status) { + return status == 201 || status == 204; + } + + } + +} diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index 6928d414..85f4914a 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -23,7 +23,6 @@ import android.accounts.AccountManager; import android.app.AlertDialog; import android.app.Dialog; import android.app.ProgressDialog; -import android.content.ContentResolver; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; diff --git a/src/com/owncloud/android/files/services/FileUploader.java b/src/com/owncloud/android/files/services/FileUploader.java index d9f3a32c..61f61791 100644 --- a/src/com/owncloud/android/files/services/FileUploader.java +++ b/src/com/owncloud/android/files/services/FileUploader.java @@ -33,9 +33,7 @@ import org.apache.jackrabbit.webdav.DavConstants; import org.apache.jackrabbit.webdav.MultiStatus; import org.apache.jackrabbit.webdav.client.methods.PropFindMethod; -import com.owncloud.android.MainApp; import com.owncloud.android.R; -import com.owncloud.android.authentication.AccountAuthenticator; import com.owncloud.android.authentication.AuthenticatorActivity; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; diff --git a/src/com/owncloud/android/operations/RenameFileOperation.java b/src/com/owncloud/android/operations/RenameFileOperation.java index 2b352bdd..ebeac791 100644 --- a/src/com/owncloud/android/operations/RenameFileOperation.java +++ b/src/com/owncloud/android/operations/RenameFileOperation.java @@ -20,23 +20,20 @@ package com.owncloud.android.operations; import java.io.File; import java.io.IOException; -import org.apache.jackrabbit.webdav.client.methods.DavMethodBase; - +import org.apache.commons.httpclient.HttpException; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.oc_framework.network.webdav.WebdavClient; -import com.owncloud.android.oc_framework.network.webdav.WebdavUtils; import com.owncloud.android.oc_framework.operations.RemoteOperation; import com.owncloud.android.oc_framework.operations.RemoteOperationResult; import com.owncloud.android.oc_framework.operations.RemoteOperationResult.ResultCode; +import com.owncloud.android.oc_framework.operations.remote.RenameRemoteFileOperation; import com.owncloud.android.utils.FileStorageUtils; import com.owncloud.android.utils.Log_OC; -//import org.apache.jackrabbit.webdav.client.methods.MoveMethod; import android.accounts.Account; - /** * Remote operation performing the rename of a remote file (or folder?) in the ownCloud server. * @@ -45,9 +42,6 @@ import android.accounts.Account; public class RenameFileOperation extends RemoteOperation { private static final String TAG = RenameFileOperation.class.getSimpleName(); - - private static final int RENAME_READ_TIMEOUT = 10000; - private static final int RENAME_CONNECTION_TIMEOUT = 5000; private OCFile mFile; @@ -87,69 +81,45 @@ public class RenameFileOperation extends RemoteOperation { protected RemoteOperationResult run(WebdavClient client) { RemoteOperationResult result = null; - LocalMoveMethod move = null; - mNewRemotePath = null; + // check if the new name is valid in the local file system try { - if (mNewName.equals(mFile.getFileName())) { - return new RemoteOperationResult(ResultCode.OK); + if (!isValidNewName()) { + return new RemoteOperationResult(ResultCode.INVALID_LOCAL_FILE_NAME); } - String parent = (new File(mFile.getRemotePath())).getParent(); parent = (parent.endsWith(OCFile.PATH_SEPARATOR)) ? parent : parent + OCFile.PATH_SEPARATOR; mNewRemotePath = parent + mNewName; if (mFile.isFolder()) { mNewRemotePath += OCFile.PATH_SEPARATOR; } - - // check if the new name is valid in the local file system - if (!isValidNewName()) { - return new RemoteOperationResult(ResultCode.INVALID_LOCAL_FILE_NAME); - } - - // check if a file with the new name already exists - if (client.existsFile(mNewRemotePath) || // remote check could fail by network failure. by indeterminate behavior of HEAD for folders ... - mStorageManager.getFileByPath(mNewRemotePath) != null) { // ... so local check is convenient + + // ckeck local overwrite + if (mStorageManager.getFileByPath(mNewRemotePath) != null) { return new RemoteOperationResult(ResultCode.INVALID_OVERWRITE); } - move = new LocalMoveMethod( client.getBaseUri() + WebdavUtils.encodePath(mFile.getRemotePath()), - client.getBaseUri() + WebdavUtils.encodePath(mNewRemotePath)); - int status = client.executeMethod(move, RENAME_READ_TIMEOUT, RENAME_CONNECTION_TIMEOUT); - if (move.succeeded()) { + + RenameRemoteFileOperation operation = new RenameRemoteFileOperation(mFile.getFileName(), mFile.getRemotePath(), + mNewName, mFile.isFolder()); + result = operation.execute(client); + if (result.isSuccess()) { if (mFile.isFolder()) { saveLocalDirectory(); - + } else { saveLocalFile(); - } - - /* - *} else if (mFile.isDirectory() && (status == 207 || status >= 500)) { - * // TODO - * // if server fails in the rename of a folder, some children files could have been moved to a folder with the new name while some others - * // stayed in the old folder; - * // - * // easiest and heaviest solution is synchronizing the parent folder (or the full account); - * // - * // a better solution is synchronizing the folders with the old and new names; - *} - */ - } - - move.getResponseBodyAsString(); // exhaust response, although not interesting - result = new RemoteOperationResult(move.succeeded(), status, move.getResponseHeaders()); - Log_OC.i(TAG, "Rename " + mFile.getRemotePath() + " to " + mNewRemotePath + ": " + result.getLogMessage()); - - } catch (Exception e) { - result = new RemoteOperationResult(e); - Log_OC.e(TAG, "Rename " + mFile.getRemotePath() + " to " + ((mNewRemotePath==null) ? mNewName : mNewRemotePath) + ": " + result.getLogMessage(), e); - - } finally { - if (move != null) - move.releaseConnection(); + } catch (HttpException e) { + Log_OC.e(TAG, "Rename " + mFile.getRemotePath() + " to " + ((mNewRemotePath==null) ? mNewName : mNewRemotePath) + ": " + + ((result!= null) ? result.getLogMessage() : ""), e); + e.printStackTrace(); + } catch (IOException e) { + Log_OC.e(TAG, "Rename " + mFile.getRemotePath() + " to " + ((mNewRemotePath==null) ? mNewName : mNewRemotePath) + ": " + + ((result!= null) ? result.getLogMessage() : ""), e); + e.printStackTrace(); } + return result; } @@ -225,26 +195,4 @@ public class RenameFileOperation extends RemoteOperation { return result; } - - // move operation - private class LocalMoveMethod extends DavMethodBase { - - public LocalMoveMethod(String uri, String dest) { - super(uri); - addRequestHeader(new org.apache.commons.httpclient.Header("Destination", dest)); - } - - @Override - public String getName() { - return "MOVE"; - } - - @Override - protected boolean isSuccess(int status) { - return status == 201 || status == 204; - } - - } - - } diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index 685cff24..0bf82075 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -1375,6 +1375,9 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa Toast msg = Toast.makeText(this, R.string.rename_local_fail_msg, Toast.LENGTH_LONG); msg.show(); // TODO throw again the new rename dialog + } if (result.getCode().equals(ResultCode.INVALID_CHARACTER_IN_NAME)) { + Toast msg = Toast.makeText(this, R.string.filename_forbidden_characters, Toast.LENGTH_LONG); + msg.show(); } else { Toast msg = Toast.makeText(this, R.string.rename_server_fail_msg, Toast.LENGTH_LONG); msg.show(); diff --git a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java index 01ef8d07..ea0f814c 100644 --- a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -816,6 +816,9 @@ public class FileDetailFragment extends FileFragment implements Toast msg = Toast.makeText(getActivity(), R.string.rename_local_fail_msg, Toast.LENGTH_LONG); msg.show(); // TODO throw again the new rename dialog + } if (result.getCode().equals(ResultCode.INVALID_CHARACTER_IN_NAME)) { + Toast msg = Toast.makeText(getActivity(), R.string.filename_forbidden_characters, Toast.LENGTH_LONG); + msg.show(); } else { Toast msg = Toast.makeText(getActivity(), R.string.rename_server_fail_msg, Toast.LENGTH_LONG); msg.show();