aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2006-06-12 16:07:58 +0000
committerRick Olson <technoweenie@gmail.com>2006-06-12 16:07:58 +0000
commitc638d9401b0e0b12af597919430cbdc6241a4057 (patch)
treef983adec6f48678616837c57260778cddee78167 /railties
parentbdc1033d2068179946d1001393e6e01c132ff428 (diff)
downloadrails-c638d9401b0e0b12af597919430cbdc6241a4057.tar.gz
rails-c638d9401b0e0b12af597919430cbdc6241a4057.tar.bz2
rails-c638d9401b0e0b12af597919430cbdc6241a4057.zip
Fix script/plugin so it doesn't barf on invalid URLs [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4450 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/lib/commands/plugin.rb16
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