Skip to content

Commit

Permalink
Fix warnings raised by URI 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jrafanie committed Nov 8, 2024
1 parent 50ff2d0 commit 92d2a9c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/models/external_url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ class ExternalUrl < ApplicationRecord
belongs_to :resource, :polymorphic => true
belongs_to :user

validates :url, :format => URI::DEFAULT_PARSER.make_regexp, :allow_nil => false
validates :url, :format => URI::RFC2396_PARSER.make_regexp, :allow_nil => false
end
2 changes: 1 addition & 1 deletion app/models/file_depot_ftp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def destination_path

def base_path
# uri: "ftp://ftp.example.com/incoming" => #<Pathname:incoming>
path = URI(URI::DEFAULT_PARSER.escape(uri)).path
path = URI(URI::RFC2396_PARSER.escape(uri)).path
Pathname.new(path)
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/git_repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class GitRepository < ApplicationRecord

attr_reader :git_lock

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

default_value_for :verify_ssl, OpenSSL::SSL::VERIFY_PEER
validates :verify_ssl, :inclusion => {:in => [OpenSSL::SSL::VERIFY_NONE, OpenSSL::SSL::VERIFY_PEER]}
Expand Down
4 changes: 2 additions & 2 deletions app/models/log_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def relative_path_for_upload(loc_file)
# Base is the URI defined by the user
# loc_file is the name of the original file
def build_log_uri(base_uri, loc_file)
scheme, userinfo, host, port, registry, path, opaque, query, fragment = URI.split(URI::DEFAULT_PARSER.escape(base_uri))
scheme, userinfo, host, port, registry, path, opaque, query, fragment = URI.split(URI::RFC2396_PARSER.escape(base_uri))

# Convert encoded spaces back to spaces
path.gsub!('%20', ' ')
Expand Down Expand Up @@ -211,7 +211,7 @@ def get_post_method(uri)
# Strip any leading and trailing whitespace
uri.strip!

URI.split(URI::DEFAULT_PARSER.escape(uri))[0]
URI.split(URI::RFC2396_PARSER.escape(uri))[0]
end

def legacy_depot_hash
Expand Down
2 changes: 1 addition & 1 deletion app/models/mixins/file_depot_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def get_uri_prefix(uri_str)
# Strip any leading and trailing whitespace
uri_str.strip!

scheme, _userinfo, _host, _port, _registry, _path, _opaque, _query, _fragment = URI.split(URI::DEFAULT_PARSER.escape(uri_str))
scheme, _userinfo, _host, _port, _registry, _path, _opaque, _query, _fragment = URI.split(URI::RFC2396_PARSER.escape(uri_str))
scheme
end
end
Expand Down

0 comments on commit 92d2a9c

Please sign in to comment.