check for site owner instead of crashing on missing current_site

This commit is contained in:
Kyle Drake 2018-05-22 22:06:16 -07:00
parent 1afb5da0bb
commit 951e66861e
2 changed files with 3 additions and 1 deletions

View file

@ -103,7 +103,7 @@ get '/site/:username/stats' do
stats = stats_dataset.all.reverse
if params[:format] == 'csv'
if current_site && @site.owned_by?(current_site) && params[:format] == 'csv'
content_type 'application/csv'
attachment "#{current_site.username}-stats.csv"