From 3c6b5951f867882c8c0dcb6770b67632010bef90 Mon Sep 17 00:00:00 2001 From: DanMeakin Date: Wed, 30 Jul 2014 16:37:22 +0100 Subject: [PATCH] Fix when opening spreadsheet with space in filename URI::InvalidURIError is raised when attempting to open a spreadsheet with spaces in the filepath. This is caused by the behaviour of the URI package. This is fixed by encoding the filepath before calling URI.parse. --- lib/roo/spreadsheet.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/roo/spreadsheet.rb b/lib/roo/spreadsheet.rb index 3b4b220d..822d0c8e 100644 --- a/lib/roo/spreadsheet.rb +++ b/lib/roo/spreadsheet.rb @@ -9,7 +9,7 @@ def open(path, options = {}) options[:file_warning] = :ignore ".#{options.delete(:extension)}".gsub(/[.]+/, ".") else - File.extname((path =~ URI::regexp) ? URI.parse(path).path : path) + File.extname((path =~ URI::regexp) ? URI.parse(URI.encode(path)).path : path) end case extension.downcase