diff --git a/app/models/metadata_image.rb b/app/models/metadata_image.rb index 46b747c..f02b178 100644 --- a/app/models/metadata_image.rb +++ b/app/models/metadata_image.rb @@ -13,6 +13,6 @@ class MetadataImage < MetadataFile # Determina si es una imagen def image? - FileMagic.new(FileMagic::MAGIC_MIME).file(file).starts_with? 'image/' + filemagic.file(file).starts_with? 'image/' end end diff --git a/app/services/post_service.rb b/app/services/post_service.rb index 46e7a64..16607a4 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -98,7 +98,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do # Eliminar metadatos internos def anon_post_params params.permit(post.params).delete_if do |k, _| - %w[date slug order uuid].include? k + %w[date slug order uuid].include? k.to_s end end diff --git a/config/initializers/bootstrap_field_with_errors.rb b/config/initializers/bootstrap_field_with_errors.rb index a372ed6..56b0a25 100644 --- a/config/initializers/bootstrap_field_with_errors.rb +++ b/config/initializers/bootstrap_field_with_errors.rb @@ -2,6 +2,8 @@ # compatible con Bootstrap4. La forma actual rompe los inputs # personalizados. ActionView::Base.field_error_proc = proc do |html_tag, _| + return unless html_tag + html = Nokogiri::HTML::DocumentFragment.parse html_tag html.children.first.attributes['class'].value += ' is-invalid' diff --git a/db/migrate/20200801230101_change_referer_to_origin.rb b/db/migrate/20200801230101_change_referer_to_origin.rb index 9c320c1..6440e7b 100644 --- a/db/migrate/20200801230101_change_referer_to_origin.rb +++ b/db/migrate/20200801230101_change_referer_to_origin.rb @@ -2,6 +2,8 @@ class ChangeRefererToOrigin < ActiveRecord::Migration[6.0] def change rename_column :access_logs, :http_referer, :http_origin + return unless Rails.env.production? + # Eliminar todos los referers anteriores manteniendo el origin ActiveRecord::Base.connection.execute("update access_logs set http_origin = split_part(http_origin, '/', 1) || '//' || split_part(http_origin, '/', 3) where http_origin is not null") end