このコミットが含まれているのは:
2026-06-26 01:20:30 +09:00
コミット d7b136c198
9個のファイルの変更407行の追加154行の削除
+15 -1
ファイルの表示
@@ -44,6 +44,12 @@ class MaterialSyncImporter
:update
end
uploaded_blob = uploaded_blob!
if @import_block
return Result.new(material: nil,
action: :suppressed,
suppressed: true,
suppression: @import_block)
end
Material.transaction do
if material.persisted?
@@ -129,11 +135,19 @@ class MaterialSyncImporter
return nil unless tempfile
tempfile.rewind
file_sha256 = @attributes[:file_sha256] || Digest::SHA256.file(tempfile.path).hexdigest
@attributes[:file_sha256] = file_sha256
@import_block = MaterialImportBlockMatcher.match_for_sha256(file_sha256)
if @import_block
tempfile.rewind
return nil
end
blob = ActiveStorage::Blob.create_and_upload!(
io: tempfile,
filename: @attributes[:filename],
content_type: @attributes[:content_type])
file_sha256 = @attributes[:file_sha256] || Digest::SHA256.file(tempfile.path).hexdigest
blob.metadata['sha256'] = file_sha256 if file_sha256.present?
blob.save! if blob.changed?
tempfile.rewind