diff --git a/app/site_files.rb b/app/site_files.rb index 3dd9132c..6a874763 100644 --- a/app/site_files.rb +++ b/app/site_files.rb @@ -52,7 +52,10 @@ post '/site_files/create' do end if extname.match(/^\.html|^\.htm/i) - current_site.install_new_html_file name + begin + current_site.install_new_html_file name + rescue Sequel::UniqueConstraintViolation + end else file_path = current_site.files_path(name) FileUtils.touch file_path diff --git a/models/site.rb b/models/site.rb index f824aef4..c9d396a9 100644 --- a/models/site.rb +++ b/models/site.rb @@ -411,10 +411,13 @@ class Site < Sequel::Model false else DB.transaction do - follow = add_following site_id: site.id - # FIXME see above. - # DB['update sites set follow_count=follow_count+1 where id=?', site.id].first if scorable_follow?(site) - Event.create site_id: site.id, actioning_site_id: self.id, follow_id: follow.id + begin + follow = add_following site_id: site.id + # FIXME see above. + # DB['update sites set follow_count=follow_count+1 where id=?', site.id].first if scorable_follow?(site) + Event.create site_id: site.id, actioning_site_id: self.id, follow_id: follow.id + rescue Sequel::UniqueConstraintViolation + end end true