Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle spec repo urls with user info when determining if they are CDN. #10942

Merged
merged 1 commit into from Sep 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verified this test fails without my change.

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