mirror of
https://github.com/nextcloud/android.git
synced 2024-11-21 12:45:32 +03:00
Merge pull request #13606 from nextcloud/bugfix/check-file-name-not-path-in-uri-uploader
BugFix - Check Filename in UriUploader
This commit is contained in:
commit
d4ea700b1b
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