lib/kindai/util.rb in kindai-2.7.0 vs lib/kindai/util.rb in kindai-2.8.0
- old
+ new
@@ -3,10 +3,11 @@
require 'tempfile'
require 'digest/sha1'
require 'rmagick'
require 'zipruby'
require 'net/http'
+require 'uri'
module Kindai::Util
def self.logger
return @logger if @logger
@logger ||= Logger.new(STDOUT)
@@ -89,9 +90,15 @@
Kindai::Util.logger.info "zip(system) #{directory}"
from = Dir.pwd
Dir.chdir(directory)
execute_and_log "zip -q -r '../#{File.basename(directory)}.zip' *jpg"
Dir.chdir(from)
+ end
+
+ def self.normalize_permalink_uri(uri_string)
+ uri = URI.parse(uri_string)
+ uri.host = 'dl.ndl.go.jp'
+ uri.to_s
end
def self.fetch_uri(uri, rich = false)
uri = URI.parse(uri) unless uri.kind_of? URI
self.logger.debug "fetch_uri #{uri}"