Skip to content

Commit

Permalink
ISSUE-675: sanitize filename in video recorder (#683)
Browse files Browse the repository at this point in the history
* ISSUE-675: sanitize filename in video recorder

* ISSUE-675: review reaction
  • Loading branch information
ersanin authored Dec 12, 2024
1 parent 501d871 commit 2a988c7
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ class VideosImpl(
) : Videos {

override fun record(tag: String) {
val videoFile: File = resourceFilesProvider.provideVideoFile(tag)
val sanitizedVideoName = tag.replace("[/:\"*?<>|]+".toRegex(), "_")
if (tag != sanitizedVideoName) {
logger.d("Can't record video with name $tag since it contains one of the following special characters [/:\"*?<>|]. Changing the name to $sanitizedVideoName")
}
val videoFile: File = resourceFilesProvider.provideVideoFile(sanitizedVideoName)
videoRecorder.start(videoFile)
}

Expand Down

0 comments on commit 2a988c7

Please sign in to comment.