Skip to content

Commit

Permalink
Check file name not path in uri uploader
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 committed Sep 23, 2024
1 parent 4ecdf79 commit 08024d5
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 08024d5

Please sign in to comment.