mirror of
https://github.com/nextcloud/android.git
synced 2024-11-25 06:35:48 +03:00
Check file name not path in uri uploader
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
4ecdf797db
commit
08024d54d5
1 changed files with 6 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue