Ticket #11351: plugin_install_from_secure_repository.diff
| File plugin_install_from_secure_repository.diff, 1.1 kB (added by danger, 7 months ago) |
|---|
-
railties/lib/commands/plugin.rb
old new 893 893 if url =~ /^svn:\/\/.*/ 894 894 `svn ls #{url}`.split("\n").map {|entry| "/#{entry}"} rescue nil 895 895 else 896 open(url ) do |stream|896 open(url, credentials(url)) do |stream| 897 897 links("", stream.read) 898 898 end rescue nil 899 899 end … … 938 938 def fetch_dir(url) 939 939 @level += 1 940 940 push_d(File.basename(url)) if @level > 0 941 open(url ) do |stream|941 open(url, credentials(url)) do |stream| 942 942 contents = stream.read 943 943 fetch(links(url, contents)) 944 944 end 945 945 pop_d if @level > 0 946 946 @level -= 1 947 947 end 948 949 def credentials(url) 950 uri = URI.parse(url) 951 raise ArgumentError, 'url is not an HTTP URI' unless uri.is_a?(URI::HTTP) 952 953 options = {} 954 if uri && uri.user 955 options[:http_basic_authentication] = [URI.unescape(uri.user), URI.unescape(uri.password)] 956 end 957 options 958 end 948 959 end 949 960 950 961 Commands::Plugin.parse!