mirror of
https://github.com/mastodon/mastodon.git
synced 2026-09-12 01:16:11 -05:00
Fix 500 error when trying to upload a non-custom-filter JSON import (#40449)
This commit is contained in:
@@ -200,8 +200,10 @@ class Form::Import
|
||||
end
|
||||
|
||||
def validate_json_data
|
||||
return errors.add(:data, I18n.t('imports.errors.incompatible_type')) unless allowed_type_for_json?
|
||||
return errors.add(:date, I18n.t('imports.errors.no_data')) if json_data.empty?
|
||||
|
||||
errors.add(:data, I18n.t('imports.errors.over_rows_processing_limit', count: ROWS_PROCESSING_LIMIT)) if json_data.count > ROWS_PROCESSING_LIMIT
|
||||
errors.add(:data, I18n.t('imports.errors.incompatible_type')) unless allowed_type_for_json?
|
||||
end
|
||||
|
||||
def content_type_is_json?
|
||||
@@ -209,7 +211,10 @@ class Form::Import
|
||||
end
|
||||
|
||||
def json_data
|
||||
parse_json['custom_filters'].map(&:deep_symbolize_keys)
|
||||
case type.to_sym
|
||||
when :custom_filters
|
||||
parse_json['custom_filters'].map(&:deep_symbolize_keys)
|
||||
end
|
||||
end
|
||||
|
||||
def parse_json
|
||||
|
||||
@@ -1709,6 +1709,7 @@ en:
|
||||
incompatible_type: Incompatible with the selected import type
|
||||
invalid_csv_file: 'Invalid CSV file. Error: %{error}'
|
||||
invalid_json_file: 'Invalid JSON file. Error: %{error}'
|
||||
no_data: This file does not contain any data matching the given import type
|
||||
over_rows_processing_limit: contains more than %{count} rows
|
||||
status_not_found_warning: Some of your filters hide specific posts that are not known by this server. These posts will not be automatically filtered if they are discovered later by the server.
|
||||
too_large: File is too large
|
||||
|
||||
Reference in New Issue
Block a user