lib/relaton/db_cache.rb in relaton-0.5.1 vs lib/relaton/db_cache.rb in relaton-0.5.2

- old
+ new

@@ -97,14 +97,15 @@ # Return item's file name # @param key [String] # @return [String] def filename(key) prefcode = key.downcase.match /^(?<prefix>[^\(]+)\((?<code>[^\)]+)/ - if prefcode - "#{@dir}/#{prefcode[:prefix]}/#{prefcode[:code].gsub(/[-:\s\/]/, '_')}.xml" - else - "#{@dir}/#{key.gsub(/[-:\s]/, '_')}.xml" - end + fn = if prefcode + "#{@dir}/#{prefcode[:prefix]}/#{prefcode[:code].gsub(/[-:\s\/]/, '_')}" + else + "#{@dir}/#{key.gsub(/[-:\s]/, '_')}" + end + fn.sub(/_$/, "") + ".xml" end # Return item's subdir # @param key [String] # @return [String]