summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2015-09-15 17:50:28 +0200
committeranonym <anonym@riseup.net>2015-09-15 17:52:52 +0200
commit50bf15c01b78fec2dbb6ad7eaf1da79cce545f4f (patch)
treeb06a9eaf013831c159b2a51da5ad0ea92b58a566
parent473f5e20a9674aa3d849a213eb7215ceffe3d5b6 (diff)
Use a whitelist approach when generating the video filename.
That is, only use known good (vs. unix) characters when converting the scenario name to a filename.
-rw-r--r--features/support/hooks.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/features/support/hooks.rb b/features/support/hooks.rb
index bd53b7e..e4cda7b 100644
--- a/features/support/hooks.rb
+++ b/features/support/hooks.rb
@@ -114,8 +114,8 @@ Before('@product') do |scenario|
if $config["CAPTURE"]
video_name = "capture-" + "#{scenario.name}-#{TIME_AT_START}.mkv"
# Sanitize the filename from unix-hostile filename characters
- bad_unix_filename_chars = Regexp.new("[\s/]")
- video_name.gsub!(bad_unix_filename_chars, '_')
+ bad_filename_chars = Regexp.new("[^A-Za-z0-9_\\-.,]")
+ video_name.gsub!(bad_filename_chars, '_')
@video_path = "#{$config['TMPDIR']}/#{video_name}"
capture = IO.popen(['avconv',
'-f', 'x11grab',