mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 23:16:22 +00:00
arreglos varios
This commit is contained in:
parent
65ceba8e6f
commit
a0660a473b
4 changed files with 6 additions and 2 deletions
|
@ -13,6 +13,6 @@ class MetadataImage < MetadataFile
|
||||||
|
|
||||||
# Determina si es una imagen
|
# Determina si es una imagen
|
||||||
def image?
|
def image?
|
||||||
FileMagic.new(FileMagic::MAGIC_MIME).file(file).starts_with? 'image/'
|
filemagic.file(file).starts_with? 'image/'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -98,7 +98,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do
|
||||||
# Eliminar metadatos internos
|
# Eliminar metadatos internos
|
||||||
def anon_post_params
|
def anon_post_params
|
||||||
params.permit(post.params).delete_if do |k, _|
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
# compatible con Bootstrap4. La forma actual rompe los inputs
|
# compatible con Bootstrap4. La forma actual rompe los inputs
|
||||||
# personalizados.
|
# personalizados.
|
||||||
ActionView::Base.field_error_proc = proc do |html_tag, _|
|
ActionView::Base.field_error_proc = proc do |html_tag, _|
|
||||||
|
return unless html_tag
|
||||||
|
|
||||||
html = Nokogiri::HTML::DocumentFragment.parse html_tag
|
html = Nokogiri::HTML::DocumentFragment.parse html_tag
|
||||||
html.children.first.attributes['class'].value += ' is-invalid'
|
html.children.first.attributes['class'].value += ' is-invalid'
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ class ChangeRefererToOrigin < ActiveRecord::Migration[6.0]
|
||||||
def change
|
def change
|
||||||
rename_column :access_logs, :http_referer, :http_origin
|
rename_column :access_logs, :http_referer, :http_origin
|
||||||
|
|
||||||
|
return unless Rails.env.production?
|
||||||
|
|
||||||
# Eliminar todos los referers anteriores manteniendo el origin
|
# 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")
|
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue