diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/RenameRemoteFileOperation.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/RenameRemoteFileOperation.kt index c89e12e8..8f669c69 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/RenameRemoteFileOperation.kt +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/RenameRemoteFileOperation.kt @@ -53,9 +53,11 @@ class RenameRemoteFileOperation( private var newRemotePath: String init { - var parent = (File(oldRemotePath)).parent!! - parent = if (parent.endsWith(File.separator)) parent else parent + File.separator - newRemotePath = parent + newName + var parent = (File(oldRemotePath)).parent ?: throw IllegalArgumentException() + if (!parent.endsWith(File.separator)) { + parent = parent.plus(File.separator) + } + newRemotePath = parent.plus(newName) if (isFolder) { newRemotePath.plus(File.separator) }