このコミットが含まれているのは:
2026-07-11 23:07:51 +09:00
コミット 19bf24432a
5個のファイルの変更70行の追加16行の削除
+7
ファイルの表示
@@ -61,6 +61,13 @@ class PostImportsController < ApplicationController
columns = Array(value['columns'])
rows = Array(value['rows'])
raise ArgumentError, '解析結果の形式が不正です.' unless columns.all?(Hash) && rows.all?(Hash)
raise ArgumentError, '取込件数が多すぎます.' if rows.length > PostImportSourceParser::MAX_ROWS
raise ArgumentError, '列数が多すぎます.' if columns.length > 50
unless rows.all? { |row| Array(row['values']).length <= columns.length &&
Array(row['values']).all? { _1.is_a?(String) && _1.bytesize <= PostImportSourceParser::MAX_CELL_BYTES } }
raise ArgumentError, '解析結果のセルが不正です.'
end
raise ArgumentError, '解析結果が大きすぎます.' if rows.sum { Array(_1['values']).sum(&:bytesize) } > PostImportSourceParser::MAX_BYTES
{ columns: columns.map { |column| column.slice('key', 'label') },
rows: rows.map { |row| { source_row: row['source_row'], values: Array(row['values']) } } }