mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
Prevent Joey's hacking from throwing exception
This commit is contained in:
parent
2b7a552b03
commit
e91208c2f2
2 changed files with 5 additions and 0 deletions
|
@ -18,6 +18,7 @@ get '/site/:username/?' do |username|
|
||||||
@current_page = 1 if @current_page == 0
|
@current_page = 1 if @current_page == 0
|
||||||
|
|
||||||
if params[:event_id]
|
if params[:event_id]
|
||||||
|
not_found unless params[:is_integer].is_integer?
|
||||||
event = Event.select(:id).where(id: params[:event_id]).first
|
event = Event.select(:id).where(id: params[:event_id]).first
|
||||||
not_found if event.nil?
|
not_found if event.nil?
|
||||||
events_dataset = Event.where(id: params[:event_id]).paginate(1, 1)
|
events_dataset = Event.where(id: params[:event_id]).paginate(1, 1)
|
||||||
|
|
|
@ -11,4 +11,8 @@ class String
|
||||||
def unindent
|
def unindent
|
||||||
gsub /^#{scan(/^\s*/).min_by{|l|l.length}}/, ""
|
gsub /^#{scan(/^\s*/).min_by{|l|l.length}}/, ""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def is_integer?
|
||||||
|
true if Integer(self) rescue false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue