mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
fix for someone sending weird URI requests periodically
This commit is contained in:
parent
75a8975941
commit
fa6158ba02
1 changed files with 11 additions and 1 deletions
12
app/blog.rb
12
app/blog.rb
|
@ -8,5 +8,15 @@ end
|
||||||
|
|
||||||
get '/blog/:article' do |article|
|
get '/blog/:article' do |article|
|
||||||
expires 500, :public, :must_revalidate
|
expires 500, :public, :must_revalidate
|
||||||
return Net::HTTP.get_response(URI("http://blog.neocities.org/#{article}.html")).body
|
|
||||||
|
attempted = false
|
||||||
|
|
||||||
|
begin
|
||||||
|
return Net::HTTP.get_response(URI("http://blog.neocities.org/#{article}.html")).body
|
||||||
|
rescue => e
|
||||||
|
raise e if attempted
|
||||||
|
attempted = true
|
||||||
|
article = article.match(/^[a-zA-Z0-9-]+/).to_s
|
||||||
|
retry
|
||||||
|
end
|
||||||
end
|
end
|
Loading…
Add table
Reference in a new issue