Skip to content

Commit 536291a

Browse files
authored
Merge pull request #35 from fujimura/save-file-to-path-which-includes-shell-meta-character
Save file to path which includes shell meta character
2 parents ece6cca + f77890e commit 536291a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/grim/image_magick_processor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def prepare_command(pdf, index, path, options)
5959
command << "-interlace none"
6060
command << "-density #{density}"
6161
command << "#{Shellwords.shellescape(pdf.path)}[#{index}]"
62-
command << path
62+
command << Shellwords.shellescape(path)
6363

6464
command
6565
end

spec/lib/grim/image_magick_processor_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@
5050
end
5151
end
5252

53+
describe "#save to path includes shell meta character" do
54+
before(:all) do
55+
@path = tmp_path("to_png_spec(1).png")
56+
@pdf = Grim::Pdf.new(fixture_path("smoker.pdf"))
57+
58+
@processor = Grim::ImageMagickProcessor.new
59+
end
60+
61+
it "should success" do
62+
@processor.save(@pdf, 0, @path, {})
63+
expect(File.exist?(@path)).to be(true)
64+
end
65+
end
66+
5367
describe "#save with width option" do
5468
before(:each) do
5569
@path = tmp_path("to_png_spec.png")

0 commit comments

Comments
 (0)