Ticket #11351: plugin_install_from_secure_repository.patch
| File plugin_install_from_secure_repository.patch, 1.1 kB (added by david.calavera, 6 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, add_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, add_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 add_credentials(url) 950 uri = URI.parse(url) 951 raise ArgumentError, 'url is not an HTTP URI' unless URI::HTTP 952 953 {:http_basic_authentication => [URI.unescape(uri.user), 954 URI.unescape(uri.password)]} unless uri.nil? || uri.user.nil? || uri.user.empty? 955 end 948 956 end 949 957 950 958 Commands::Plugin.parse!