Skip to content

Commit

Permalink
upgrade task to repair xlsx blobs changed to zip #1820
Browse files Browse the repository at this point in the history
  • Loading branch information
stuzart committed Jul 18, 2024
1 parent 3356736 commit 40f8650
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/tasks/seek_upgrades.rake
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace :seek do
implement_assay_streams_for_isa_assays
set_ls_login_legacy_mode
rename_custom_metadata_legacy_supported_type
fix_xlsx_marked_as_zip
]

# these are the tasks that are executes for each upgrade as standard, and rarely change
Expand Down Expand Up @@ -205,6 +206,15 @@ namespace :seek do
end
end

task(fix_xlsx_marked_as_zip: [:environment]) do
blobs = ContentBlob.where('original_filename LIKE ?','%.xlsx').where(content_type: 'application/zip')
if blobs.any?
n = blobs.count
blobs.update_all(content_type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
puts "... fixed #{n} XLSX blobs with zip content type"
end
end

private

##
Expand Down

0 comments on commit 40f8650

Please sign in to comment.