Skip to content

Commit 7e547c3

Browse files
committed
Finish 3.1.4
2 parents f92daa7 + a4072c3 commit 7e547c3

5 files changed

Lines changed: 14 additions & 10 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.3
1+
3.1.4

lib/rdf/model/uri.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# coding: utf-8
2-
require 'uri'
2+
require 'cgi'
33

44
module RDF
55
##
@@ -846,7 +846,7 @@ def parse(value)
846846
parts[:user] = (user.dup.force_encoding(Encoding::UTF_8) if user)
847847
parts[:password] = (password.dup.force_encoding(Encoding::UTF_8) if password)
848848
parts[:host] = (host.dup.force_encoding(Encoding::UTF_8) if host)
849-
parts[:port] = (URI.decode(port).to_i if port)
849+
parts[:port] = (CGI.unescape(port).to_i if port)
850850
parts[:path] = (path.to_s.dup.force_encoding(Encoding::UTF_8) unless path.empty?)
851851
parts[:query] = (query[1..-1].dup.force_encoding(Encoding::UTF_8) if query)
852852
parts[:fragment] = (fragment[1..-1].dup.force_encoding(Encoding::UTF_8) if fragment)
@@ -902,7 +902,7 @@ def user=(value)
902902
# Normalized version of user
903903
# @return [String]
904904
def normalized_user
905-
URI.encode(URI.decode(user), /[^#{IUNRESERVED}|#{SUB_DELIMS}]/) if user
905+
URI.encode(CGI.unescape(user), /[^#{IUNRESERVED}|#{SUB_DELIMS}]/) if user
906906
end
907907

908908
##
@@ -928,7 +928,7 @@ def password=(value)
928928
# Normalized version of password
929929
# @return [String]
930930
def normalized_password
931-
URI.encode(URI.decode(password), /[^#{IUNRESERVED}|#{SUB_DELIMS}]/) if password
931+
URI.encode(CGI.unescape(password), /[^#{IUNRESERVED}|#{SUB_DELIMS}]/) if password
932932
end
933933

934934
HOST_FROM_AUTHORITY_RE = /(?:[^@]+@)?([^:]+)(?::.*)?$/.freeze
@@ -1180,8 +1180,8 @@ def query_values(return_type=Hash)
11801180
inject(return_type == Hash ? {} : []) do |memo,kv|
11811181
k,v = kv.to_s.split('=', 2)
11821182
next if k.to_s.empty?
1183-
k = URI.decode(k)
1184-
v = URI.decode(v) if v
1183+
k = CGI.unescape(k)
1184+
v = CGI.unescape(v) if v
11851185
if return_type == Hash
11861186
case memo[k]
11871187
when nil then memo[k] = v
@@ -1293,7 +1293,7 @@ def self._load(data)
12931293
def normalize_segment(value, expr, downcase = false)
12941294
if value
12951295
value = value.dup.force_encoding(Encoding::UTF_8)
1296-
decoded = URI.decode(value)
1296+
decoded = CGI.unescape(value)
12971297
decoded.downcase! if downcase
12981298
URI.encode(decoded, /[^(?:#{expr})]/)
12991299
end

lib/rdf/ntriples/reader.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# -*- encoding: utf-8 -*-
2+
3+
require 'strscan'
4+
25
module RDF::NTriples
36
##
47
# N-Triples parser.

lib/rdf/util/logger.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ def log_depth(**options, &block)
219219
# @return [void]
220220
def logger_common(*args, level:, **options)
221221
logger = self.logger(**options)
222-
logger.log_statistics[level] = logger.log_statistics[level].to_i + 1
223222
# Some older code uses integer level numbers
224223
level = LOGGER_COMMON_LEVELS_REVERSE.fetch(level) if level.is_a?(Integer)
224+
logger.log_statistics[level] = logger.log_statistics[level].to_i + 1
225225
return if logger.level > LOGGER_COMMON_LEVELS.fetch(level)
226226

227227
depth = options.fetch(:depth, logger.log_depth)

lib/rdf/vocab/writer.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require 'rdf'
22
require 'rdf/vocabulary'
3+
require 'cgi'
34

45
module RDF
56
##
@@ -84,7 +85,7 @@ def self.options
8485
on: ["--extra URIEncodedJSON"],
8586
description: "URI Encoded JSON representation of extra data"
8687
) do |arg|
87-
::JSON.parse(::URI.decode(arg)).inject({}) do |m1, (term, defs)|
88+
::JSON.parse(::CGI.unescape(arg)).inject({}) do |m1, (term, defs)|
8889
d1 = defs.inject({}) {|m, (k,v)| m.merge(k.to_sym => v)}
8990
m1.merge(term.to_sym => d1)
9091
end

0 commit comments

Comments
 (0)