diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index bfb3ce7e8bd..b9f78feb141 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -46,10 +46,6 @@ class ActivityPub::Activity::Create < ActivityPub::Activity ) end - def reject_pattern? - Setting.reject_pattern.present? && @object['content']&.match?(Setting.reject_pattern) - end - def create_status return reject_payload! if unsupported_object_type? || non_matching_uri_hosts?(@account.uri, object_uri) || tombstone_exists? || !related_to_local_activity? || reject_pattern? @@ -417,6 +413,10 @@ class ActivityPub::Activity::Create < ActivityPub::Activity Tombstone.exists?(uri: object_uri) end + def reject_pattern? + Setting.reject_pattern.present? && @object['content']&.match?(Setting.reject_pattern) + end + def forward_for_reply return unless @status.distributable? && @json['signature'].present? && reply_to_local? diff --git a/app/validators/regexp_syntax_validator.rb b/app/validators/regexp_syntax_validator.rb index 57ecf882c24..dd8dc80c9fe 100644 --- a/app/validators/regexp_syntax_validator.rb +++ b/app/validators/regexp_syntax_validator.rb @@ -4,10 +4,8 @@ class RegexpSyntaxValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) return if value.blank? - begin - Regexp.compile(value) - rescue RegexpError => e - record.errors.add(attribute, I18n.t('applications.invalid_regexp', message: e.message)) - end + Regexp.compile(value) + rescue RegexpError => e + record.errors.add(attribute, I18n.t('applications.invalid_regexp', message: e.message)) end end