Skip to content

Strip extension from screenshot filename

Paul Gascou-Vaillancourt requested to merge fix-generated-screenshot-names into master

What does this MR do?

When generating milestone-specific screenshots with a screenshot generator, the script takes the file's basename and appends _v#{milestone}.png to it. There is a small issue with how it's done because we get the base name with File.basename(file), which, according to the docs, returns the filename with the extension:

File.basename("/home/gumby/work/ruby.rb")          #=> "ruby.rb"

As a result of this, we end up with file names where the extension is repeated (e.g. suggested_solutions_settings.png_v13.5.png.

To fix this, we can provide the second parameter to the basename method in order to strip any extension from the file name:

File.basename("/home/gumby/work/ruby.rb", ".*")    #=> "ruby"

Does this MR meet the acceptance criteria?

Conformity

Merge request reports

Loading