diff options
-rw-r--r-- | railties/CHANGELOG | 2 | ||||
-rw-r--r-- | railties/lib/commands/plugin.rb | 16 |
2 files changed, 12 insertions, 6 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 7faff77bc0..cef30c0e72 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fix script/plugin so it doesn't barf on invalid URLs [Rick] + * Fix plugin install bug at dir with space. (closes #5359) [Yoshimasa NIWA] * Fix bug with 'script/plugin install' so it reports unknown plugin names correctly. [Rick] diff --git a/railties/lib/commands/plugin.rb b/railties/lib/commands/plugin.rb index e836115fc9..22f569acdc 100644 --- a/railties/lib/commands/plugin.rb +++ b/railties/lib/commands/plugin.rb @@ -684,13 +684,17 @@ module Commands puts "Scraping #{uri}" if $verbose dupes = [] content = open(uri).each do |line| - if line =~ /<a[^>]*href=['"]([^'"]*)['"]/ or line =~ /(svn:\/\/[^<|\n]*)/ - uri = $1 - if uri =~ /\/plugins\// and uri !~ /\/browser\// - uri = extract_repository_uri(uri) - yield uri unless dupes.include?(uri) or Repositories.instance.exist?(uri) - dupes << uri + begin + if line =~ /<a[^>]*href=['"]([^'"]*)['"]/ || line =~ /(svn:\/\/[^<|\n]*)/ + uri = $1 + if uri =~ /^\w+:\/\// && uri =~ /\/plugins\// && uri !~ /\/browser\// && uri !~ /^http:\/\/wiki\.rubyonrails/ && uri !~ /http:\/\/instiki/ + uri = extract_repository_uri(uri) + yield uri unless dupes.include?(uri) || Repositories.instance.exist?(uri) + dupes << uri + end end + rescue + puts "Problems scraping '#{uri}': #{$!.to_s}" end end end |