Skip to content

Commit 35bd2c9

Browse files
committed
Fix warnings raised by URI 1.0.1
Related to: https://www.github.com/ruby/uri/issues/125 #23260
1 parent 50ff2d0 commit 35bd2c9

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

app/models/external_url.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ class ExternalUrl < ApplicationRecord
22
belongs_to :resource, :polymorphic => true
33
belongs_to :user
44

5-
validates :url, :format => URI::DEFAULT_PARSER.make_regexp, :allow_nil => false
5+
validates :url, :format => URI::RFC2396_PARSER.make_regexp, :allow_nil => false
66
end

app/models/file_depot_ftp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def destination_path
127127

128128
def base_path
129129
# uri: "ftp://ftp.example.com/incoming" => #<Pathname:incoming>
130-
path = URI(URI::DEFAULT_PARSER.escape(uri)).path
130+
path = URI(URI::RFC2396_PARSER.escape(uri)).path
131131
Pathname.new(path)
132132
end
133133

app/models/git_repository.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class GitRepository < ApplicationRecord
99

1010
attr_reader :git_lock
1111

12-
validates :url, :format => Regexp.union(URI::DEFAULT_PARSER.make_regexp(%w[http https file ssh]), /\A[-\w:.]+@.*:/), :allow_nil => false
12+
validates :url, :format => Regexp.union(URI::RFC2396_PARSER.make_regexp(%w[http https file ssh]), /\A[-\w:.]+@.*:/), :allow_nil => false
1313

1414
default_value_for :verify_ssl, OpenSSL::SSL::VERIFY_PEER
1515
validates :verify_ssl, :inclusion => {:in => [OpenSSL::SSL::VERIFY_NONE, OpenSSL::SSL::VERIFY_PEER]}

app/models/log_file.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def relative_path_for_upload(loc_file)
2727
# Base is the URI defined by the user
2828
# loc_file is the name of the original file
2929
def build_log_uri(base_uri, loc_file)
30-
scheme, userinfo, host, port, registry, path, opaque, query, fragment = URI.split(URI::DEFAULT_PARSER.escape(base_uri))
30+
scheme, userinfo, host, port, registry, path, opaque, query, fragment = URI.split(URI::RFC2396_PARSER.escape(base_uri))
3131

3232
# Convert encoded spaces back to spaces
3333
path.gsub!('%20', ' ')
@@ -211,7 +211,7 @@ def get_post_method(uri)
211211
# Strip any leading and trailing whitespace
212212
uri.strip!
213213

214-
URI.split(URI::DEFAULT_PARSER.escape(uri))[0]
214+
URI.split(URI::RFC2396_PARSER.escape(uri))[0]
215215
end
216216

217217
def legacy_depot_hash

app/models/mixins/file_depot_mixin.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def get_uri_prefix(uri_str)
5757
# Strip any leading and trailing whitespace
5858
uri_str.strip!
5959

60-
scheme, _userinfo, _host, _port, _registry, _path, _opaque, _query, _fragment = URI.split(URI::DEFAULT_PARSER.escape(uri_str))
60+
scheme, _userinfo, _host, _port, _registry, _path, _opaque, _query, _fragment = URI.split(URI::RFC2396_PARSER.escape(uri_str))
6161
scheme
6262
end
6363
end

0 commit comments

Comments
 (0)