From 7b6a28906a5d19696cd3fcbc35759ccb157dc6df Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Sat, 17 Aug 2013 13:51:53 +0900 Subject: updated image source validation to use lower case comparison of accepted file extensions --- lib/axlsx/drawing/pic.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3