Skip to content

Commit

Permalink
Merge pull request #10942 from CocoaPods/userinfo_cdn_url
Browse files Browse the repository at this point in the history
Handle spec repo urls with user info when determining if they are CDN.
  • Loading branch information
dnkoutso committed Sep 12, 2021
2 parents 4855e1d + bae03f2 commit 8348236
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -12,6 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`

##### Bug Fixes

* Handle spec repo urls with user info when determining if they are CDN.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#10941](https://github.com/CocoaPods/CocoaPods/issues/10941)

* Set `INFOPLIST_FILE` build setting to `$(SRCROOT)/App/App-Info.plist` during lint.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#10927](https://github.com/CocoaPods/CocoaPods/issues/10927)
Expand Down
7 changes: 5 additions & 2 deletions lib/cocoapods/sources_manager.rb
Expand Up @@ -71,12 +71,15 @@ def create_source_with_url(url)
# The URL of the source.
#
def cdn_url?(url)
return unless url =~ %r{^https?:\/\/}
return false unless url =~ %r{^https?:\/\/}

uri_options = {}

netrc_info = Netrc.read
netrc_host = URI.parse(url).host
uri = URI.parse(url)
return false unless uri.userinfo.nil?

netrc_host = uri.host
credentials = netrc_info[netrc_host]
uri_options[:http_basic_authentication] = credentials if credentials

Expand Down
4 changes: 4 additions & 0 deletions spec/unit/sources_manager_spec.rb
Expand Up @@ -154,6 +154,10 @@ module Pod
@sources_manager.cdn_url?('http://cdn.cocoapods.org').should == true
end

it 'spec repo with userinfo' do
@sources_manager.cdn_url?('https://foo:bar@bitbucket.org/foobar/Specs.git').should == false
end

it 'git master spec repo' do
stub_as_404('https://github.com/cocoapods/specs.git')
stub_as_404('https://github.com/cocoapods/specs')
Expand Down

0 comments on commit 8348236

Please sign in to comment.