Skip to content

Commit

Permalink
Merge pull request #35 from fujimura/save-file-to-path-which-includes…
Browse files Browse the repository at this point in the history
…-shell-meta-character

Save file to path which includes shell meta character
  • Loading branch information
jonmagic committed Sep 11, 2017
2 parents ece6cca + f77890e commit 536291a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/grim/image_magick_processor.rb
Expand Up @@ -59,7 +59,7 @@ def prepare_command(pdf, index, path, options)
command << "-interlace none"
command << "-density #{density}"
command << "#{Shellwords.shellescape(pdf.path)}[#{index}]"
command << path
command << Shellwords.shellescape(path)

command
end
Expand Down
14 changes: 14 additions & 0 deletions spec/lib/grim/image_magick_processor_spec.rb
Expand Up @@ -50,6 +50,20 @@
end
end

describe "#save to path includes shell meta character" do
before(:all) do
@path = tmp_path("to_png_spec(1).png")
@pdf = Grim::Pdf.new(fixture_path("smoker.pdf"))

@processor = Grim::ImageMagickProcessor.new
end

it "should success" do
@processor.save(@pdf, 0, @path, {})
expect(File.exist?(@path)).to be(true)
end
end

describe "#save with width option" do
before(:each) do
@path = tmp_path("to_png_spec.png")
Expand Down

0 comments on commit 536291a

Please sign in to comment.