summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/drawing/pic.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2013-08-17 13:51:53 +0900
committerRandy Morgan <[email protected]>2013-08-17 13:51:53 +0900
commit7b6a28906a5d19696cd3fcbc35759ccb157dc6df (patch)
tree1c47bab700f96633e5d1cab5fa7ffa1ce16ed065 /lib/axlsx/drawing/pic.rb
parent3411a6d22a228e7170e4058d1d1715ef507ccffb (diff)
downloadcaxlsx-7b6a28906a5d19696cd3fcbc35759ccb157dc6df.tar.gz
caxlsx-7b6a28906a5d19696cd3fcbc35759ccb157dc6df.zip
updated image source validation to use lower case comparison of accepted file extensions
Diffstat (limited to 'lib/axlsx/drawing/pic.rb')
-rw-r--r--lib/axlsx/drawing/pic.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/axlsx/drawing/pic.rb b/lib/axlsx/drawing/pic.rb
index 89f4c1ea..a6c85705 100644
--- a/lib/axlsx/drawing/pic.rb
+++ b/lib/axlsx/drawing/pic.rb
@@ -37,7 +37,7 @@ module Axlsx
attr_reader :descr
# The path to the image you want to include
- # Only local images are supported at this time and only jpg support
+ # Only local images are supported at this time.
# @return [String]
attr_reader :image_src
@@ -67,7 +67,7 @@ module Axlsx
def image_src=(v)
Axlsx::validate_string(v)
- RestrictionValidator.validate 'Pic.image_src', ALLOWED_EXTENSIONS, File.extname(v).delete('.')
+ RestrictionValidator.validate 'Pic.image_src', ALLOWED_EXTENSIONS, File.extname(v.downcase).delete('.')
raise ArgumentError, "File does not exist" unless File.exist?(v)
@image_src = v
end
@@ -89,7 +89,8 @@ module Axlsx
# @return [String]
def extname
File.extname(image_src).delete('.') unless image_src.nil?
- end
+ end
+
# The index of this image in the workbooks images collections
# @return [Index]
def index