X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/5af0fb44b4c859f9f7f7aca39376686f091b496e..9aab2d26da38f26e7ff03a0b5db3bd01b51bce05:/src/com/owncloud/android/operations/RenameFileOperation.java diff --git a/src/com/owncloud/android/operations/RenameFileOperation.java b/src/com/owncloud/android/operations/RenameFileOperation.java index 6050aa88..ada17432 100644 --- a/src/com/owncloud/android/operations/RenameFileOperation.java +++ b/src/com/owncloud/android/operations/RenameFileOperation.java @@ -28,8 +28,8 @@ import android.util.Log; import com.owncloud.android.datamodel.DataStorageManager; import com.owncloud.android.datamodel.OCFile; -import com.owncloud.android.files.services.FileDownloader; import com.owncloud.android.operations.RemoteOperationResult.ResultCode; +import com.owncloud.android.utils.FileStorageUtils; import eu.alefzero.webdav.WebdavClient; import eu.alefzero.webdav.WebdavUtils; @@ -41,7 +41,7 @@ import eu.alefzero.webdav.WebdavUtils; */ public class RenameFileOperation extends RemoteOperation { - private static final String TAG = RemoveFileOperation.class.getCanonicalName(); + private static final String TAG = RemoveFileOperation.class.getSimpleName(); private static final int RENAME_READ_TIMEOUT = 10000; private static final int RENAME_CONNECTION_TIMEOUT = 5000; @@ -152,16 +152,18 @@ public class RenameFileOperation extends RemoteOperation { * IMPORTANT: The test must be made in the same file system where files are download. The internal storage * could be formatted with a different file system. * + * TODO move this method, and maybe FileDownload.get***Path(), to a class with utilities specific for the interactions with the file system + * * @return 'True' if a temporal file named with the name to set could be created in the file system where * local files are stored. */ private boolean isValidNewName() { // check tricky names - if (mNewName == null || mNewName.length() <= 0 || mNewName.contains(File.separator)) { + if (mNewName == null || mNewName.length() <= 0 || mNewName.contains(File.separator) || mNewName.contains("%")) { return false; } // create a test file - String tmpFolder = FileDownloader.getTemporalPath(""); + String tmpFolder = FileStorageUtils.getTemporalPath(""); File testFile = new File(tmpFolder + mNewName); try { testFile.createNewFile(); // return value is ignored; it could be 'false' because the file already existed, that doesn't invalidate the name