Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BugFix - Check Filename in UriUploader #13606

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading