diff --git a/kaspresso/src/main/kotlin/com/kaspersky/kaspresso/device/video/VideosImpl.kt b/kaspresso/src/main/kotlin/com/kaspersky/kaspresso/device/video/VideosImpl.kt index bdf99a2f9..0f7263c79 100644 --- a/kaspresso/src/main/kotlin/com/kaspersky/kaspresso/device/video/VideosImpl.kt +++ b/kaspresso/src/main/kotlin/com/kaspersky/kaspresso/device/video/VideosImpl.kt @@ -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) }