From 51096a0d82b55c6dc15e5506a5bc0d1cb219fd18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20Garci=CC=81a=20de=20Prada?= Date: Mon, 24 May 2021 11:27:44 +0200 Subject: [PATCH] Apply code review suggestions --- .../lib/resources/files/RenameRemoteFileOperation.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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) }