Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix rubyforge bug [#29596], Quotes in values.

  • Loading branch information...
commit 36950ac88dc0d3851d77387aac44240e8b357cd9 1 parent 63f3007
janfri authored
Showing with 23 additions and 1 deletion.
  1. +1 −1  lib/mini_exiftool.rb
  2. +22 −0 test/test_write.rb
2  lib/mini_exiftool.rb
View
@@ -154,7 +154,7 @@ def save
arr_val.map! {|e| convert e}
tag_params = ''
arr_val.each do |v|
- tag_params << %Q(-#{original_tag}="#{v}" )
+ tag_params << %Q(-#{original_tag}=#{Shellwords.escape(v)} )
end
opt_params = ''
opt_params << (arr_val.detect {|x| x.kind_of?(Numeric)} ? '-n ' : '')
22 test/test_write.rb
View
@@ -55,6 +55,28 @@ def test_access_non_writable_tags
assert_equal true, @mini_exiftool_num.changed?
end
+ # Catching rubyforge bug [#29596]
+ # Thanks to Michael Grove for reporting
+ # Part 1
+ def test_quotes_in_values
+ caption = "\"String in quotes\""
+ @mini_exiftool.caption = caption
+ assert_equal true, @mini_exiftool.save, 'Saving error'
+ @mini_exiftool.reload
+ assert_equal caption, @mini_exiftool.caption
+ end
+
+ # Catching rubyforge bug [#29596]
+ # Thanks to Michael Grove for reporting
+ # Part 2
+ def test_quotes_and_apostrophe_in_values
+ caption = caption = "\"Watch your step, it's slippery.\""
+ @mini_exiftool.caption = caption
+ assert_equal true, @mini_exiftool.save, 'Saving error'
+ @mini_exiftool.reload
+ assert_equal caption, @mini_exiftool.caption
+ end
+
def test_time_conversion
t = Time.now
@mini_exiftool_num['DateTimeOriginal'] = t
Please sign in to comment.
Something went wrong with that request. Please try again.