Skip to content
Browse files

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
  • Loading branch information...
1 parent bdc1033 commit c638d9401b0e0b12af597919430cbdc6241a4057 @technoweenie technoweenie committed Jun 12, 2006
Showing with 12 additions and 6 deletions.
  1. +2 −0 railties/CHANGELOG
  2. +10 −6 railties/lib/commands/plugin.rb
View
2 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]
View
16 railties/lib/commands/plugin.rb
@@ -684,13 +684,17 @@ def scrape(uri)
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

0 comments on commit c638d94

Please sign in to comment.
Something went wrong with that request. Please try again.