v0.36.4 Rewrite broken upload_attachment due to 3.2.5 handling things differently

This commit is contained in:
David Sainty 2024-08-14 23:47:51 +10:00
parent f2b459b22c
commit 89e8ebf0b9

View File

@ -1,7 +1,7 @@
# Federated Computer, Inc. # Federated Computer, Inc.
# David Sainty <saint@federated.computer> 2024 A.D. # David Sainty <saint@federated.computer> 2024 A.D.
# Gossamer Threads to Discourse -- Migration-Import Script # Gossamer Threads to Discourse -- Migration-Import Script
# v0.36.2 Rewrite broken upload_attachment due to 3.2.5 handling things differently # v0.36.4 Rewrite broken upload_attachment due to 3.2.5 handling things differently
require 'mysql2' require 'mysql2'
require 'open-uri' require 'open-uri'
@ -397,6 +397,9 @@ class GossamerForumsImporter < ImportScripts::Base
# retain_hours: nil # retain_hours: nil
) )
# Save the upload object before generating the file path
upload.save!
# Use FileStore::LocalStore to store the file # Use FileStore::LocalStore to store the file
store = FileStore::LocalStore.new store = FileStore::LocalStore.new
upload.url = store.store_file(file, store.get_path_for('original', upload.id, upload.sha1, File.extname(file.path))) upload.url = store.store_file(file, store.get_path_for('original', upload.id, upload.sha1, File.extname(file.path)))