v0.15.7 URI.encode fix

This commit is contained in:
David Sainty 2024-06-26 22:33:49 +10:00
parent 26c18138eb
commit 95334e5492

View File

@ -1,5 +1,5 @@
# gossamer threads migration-import code # gossamer threads migration-import code
# v0.15.6 # v0.15.7
require 'mysql2' require 'mysql2'
require 'open-uri' require 'open-uri'
@ -397,7 +397,8 @@ class GossamerForumsImporter < ImportScripts::Base
images_imported = 0 images_imported = 0
execute_query("SELECT * FROM gforum_User_Files WHERE ForeignColKey = #{original_gossamer_id}").each do |file| execute_query("SELECT * FROM gforum_User_Files WHERE ForeignColKey = #{original_gossamer_id}").each do |file|
file_url = "https://forum.slowtwitch.com/images/users/images/#{file['ID'] % 10}/#{file['ID']}-#{file['File_Name']}" encoded_filename = URI.encode(file['File_Name'])
file_url = "https://forum.slowtwitch.com/images/users/images/#{file['ID'] % 10}/#{file['ID']}-#{encoded_filename}"
puts "User #{user.username} User ID: #{user.id} original_gossamer_id: #{original_gossamer_id} file_url: #{file_url}" puts "User #{user.username} User ID: #{user.id} original_gossamer_id: #{original_gossamer_id} file_url: #{file_url}"
next unless file['ForeignColName'] =~ /^user_image\d+$/ next unless file['ForeignColName'] =~ /^user_image\d+$/