diff --git a/app/src/main/java/com/owncloud/android/ui/helpers/UriUploader.kt b/app/src/main/java/com/owncloud/android/ui/helpers/UriUploader.kt index 19f02c3726..826741aa94 100644 --- a/app/src/main/java/com/owncloud/android/ui/helpers/UriUploader.kt +++ b/app/src/main/java/com/owncloud/android/ui/helpers/UriUploader.kt @@ -25,6 +25,7 @@ import com.owncloud.android.ui.asynctasks.CopyAndUploadContentUrisTask import com.owncloud.android.ui.asynctasks.CopyAndUploadContentUrisTask.OnCopyTmpFilesTaskListener import com.owncloud.android.ui.fragment.TaskRetainerFragment import com.owncloud.android.utils.UriUtils.getDisplayNameForUri +import java.io.File /** * This class examines URIs pointing to files to upload and then requests [FileUploadHelper] to upload them. @@ -79,9 +80,12 @@ class UriUploader( .filterNotNull() .map { it as Uri } .map { Pair(it, getRemotePathForUri(it)) } - .filter { (_, filename) -> + .filter { (_, path) -> + val file = File(path) + val filename = file.name + isFilenameValid = FileNameValidator.checkFileName( - filename.removePrefix("/"), + filename, mActivity.capabilities, mActivity, null