about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-07-15 16:56:33 +0200
committerGitHub <noreply@github.com>2020-07-15 16:56:33 +0200
commit37c092e9fdedd36c167e4b84610e7346c446e1d3 (patch)
tree88992f2d65c83ece4e93f0b4b5c34ffed0989138 /app/models
parent7a23347db5be3f262dbcafbecf768588dc648bda (diff)
parent470458da13586db0e6ca074987fecfc80293d955 (diff)
Merge pull request #1382 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models')
-rw-r--r--app/models/concerns/omniauthable.rb2
-rw-r--r--app/models/media_attachment.rb6
2 files changed, 4 insertions, 4 deletions
diff --git a/app/models/concerns/omniauthable.rb b/app/models/concerns/omniauthable.rb
index 736da6c1d..4ea219537 100644
--- a/app/models/concerns/omniauthable.rb
+++ b/app/models/concerns/omniauthable.rb
@@ -57,7 +57,7 @@ module Omniauthable
 
       user = User.new(user_params_from_auth(email, auth))
 
-      user.account.avatar_remote_url = auth.info.image if auth.info.image =~ /\A#{URI.regexp(%w(http https))}\z/
+      user.account.avatar_remote_url = auth.info.image if auth.info.image =~ /\A#{URI::DEFAULT_PARSER.make_regexp(%w(http https))}\z/
       user.skip_confirmation!
       user.save!
       user
diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb
index cc0a1ab27..0441fc699 100644
--- a/app/models/media_attachment.rb
+++ b/app/models/media_attachment.rb
@@ -165,6 +165,9 @@ class MediaAttachment < ApplicationRecord
                     processors: ->(f) { file_processors f },
                     convert_options: GLOBAL_CONVERT_OPTIONS
 
+  before_file_post_process :set_type_and_extension
+  before_file_post_process :check_video_dimensions
+
   validates_attachment_content_type :file, content_type: IMAGE_MIME_TYPES + VIDEO_MIME_TYPES + AUDIO_MIME_TYPES
   validates_attachment_size :file, less_than: IMAGE_LIMIT, unless: :larger_media_format?
   validates_attachment_size :file, less_than: VIDEO_LIMIT, if: :larger_media_format?
@@ -257,9 +260,6 @@ class MediaAttachment < ApplicationRecord
 
   after_post_process :set_meta
 
-  before_file_post_process :set_type_and_extension
-  before_file_post_process :check_video_dimensions
-
   class << self
     def supported_mime_types
       IMAGE_MIME_TYPES + VIDEO_MIME_TYPES + AUDIO_MIME_TYPES