From 69611ee3b5995782f60fb594ae66ecda4e45c9bc Mon Sep 17 00:00:00 2001 From: saint Date: Mon, 1 Jul 2024 12:57:53 +1000 Subject: [PATCH] v0.21.4 Fix coding oversight for image upload handling --- gossamer_forums.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gossamer_forums.rb b/gossamer_forums.rb index 0a3b378..734a29a 100644 --- a/gossamer_forums.rb +++ b/gossamer_forums.rb @@ -1,5 +1,5 @@ # gossamer threads migration-import code -# v0.21.3 +# v0.21.4 require 'mysql2' require 'open-uri' @@ -300,10 +300,10 @@ class GossamerForumsImporter < ImportScripts::Base end # Helper method to upload an attachment / image to Discourse - def upload_attachment(user, file, filename, gossamer_url) + def upload_attachment(user_id, file, filename, gossamer_url) begin upload = Upload.create!( - user_id: user.id, + user_id: user_id, original_filename: filename, filesize: file.size, # filesize: File.size(file.path), @@ -320,7 +320,7 @@ class GossamerForumsImporter < ImportScripts::Base upload.save! upload rescue => e - puts "Failed to upload attachment #{filename} for user #{user.username}: #{e.message}" + puts "Failed to upload attachment #{filename} for user_id #{user_id}: #{e.message}" nil end end