aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/source
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2023-01-17 20:53:52 +0100
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-03-17 18:50:55 +0900
commitddc4fd5644ae40e6b817fc534f0de0f9c867e7b7 (patch)
tree6555d7277c3afbfb4f66bd2eb0dc243ee90798f2 /lib/bundler/source
parent7800d4eeb5cfcd367a596044c183c547642066e2 (diff)
downloadruby-ddc4fd5644ae40e6b817fc534f0de0f9c867e7b7.tar.gz
Normalize git sources
Just like gem sources, a "style-only" change, like adding a trailing slash, should not expire them.
Diffstat (limited to 'lib/bundler/source')
-rw-r--r--lib/bundler/source/git.rb2
-rw-r--r--lib/bundler/source/rubygems.rb3
2 files changed, 2 insertions, 3 deletions
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb
index cf8c417ca4..42897813b4 100644
--- a/lib/bundler/source/git.rb
+++ b/lib/bundler/source/git.rb
@@ -19,7 +19,7 @@ module Bundler
# Stringify options that could be set as symbols
%w[ref branch tag revision].each {|k| options[k] = options[k].to_s if options[k] }
- @uri = options["uri"] || ""
+ @uri = URINormalizer.normalize_suffix(options["uri"] || "", :trailing_slash => false)
@safe_uri = URICredentialsFilter.credential_filtered_uri(@uri)
@branch = options["branch"]
@ref = options["ref"] || options["branch"] || options["tag"]
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index c39071705a..8d0c78bd61 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -337,8 +337,7 @@ module Bundler
end
def normalize_uri(uri)
- uri = uri.to_s
- uri = "#{uri}/" unless %r{/$}.match?(uri)
+ uri = URINormalizer.normalize_suffix(uri.to_s)
require_relative "../vendored_uri"
uri = Bundler::URI(uri)
raise ArgumentError, "The source must be an absolute URI. For example:\n" \