lib/filbunke/client.rb in filbunke-1.11.8 vs lib/filbunke/client.rb in filbunke-1.11.9
- old
+ new
@@ -8,10 +8,11 @@
LAST_CHECKPOINT_ACTION = 'last_checkpoint'
TOUCH_ACTION = 'touch'
URL_KEY = 'url'
FROM_CHECKPOINT_KEY = 'from_checkpoint'
HASH_KEY = 'hash'
+ URI_UNSAFE_CHARACTERS = '/[^.:\/\w-]/'
def initialize(repository, logger, callbacks = [], failed_request_log_file_name = nil)
@repository = repository
@logger = logger
@@ -221,18 +222,18 @@
end
end
rescue StandardError => e
@logger.error "Unable to create HTTP connection to #{@repository.host}:#{@repository.port} (#{e.message})!"
return {}
- end
+ end
end
def update_http_file!(file, local_file_path)
begin
async_request = if @repository.user
- Typhoeus::Request.new(URI.encode(file.url), :follow_location => true, :username => @repository.user, :password => @repository.pass)
+ Typhoeus::Request.new(URI.encode(file.url, URI_UNSAFE_CHARACTERS), :follow_location => true, :username => @repository.user, :password => @repository.pass)
else
- Typhoeus::Request.new(URI.encode(file.url), :follow_location => true)
+ Typhoeus::Request.new(URI.encode(file.url, URI_UNSAFE_CHARACTERS), :follow_location => true)
end
async_request.on_complete do |response|
success = false
begin
success = response.code.to_i == 200