From 0c7f521b1596dff69d5e7b0e0693e0f63fb84c84 Mon Sep 17 00:00:00 2001 From: saint Date: Wed, 26 Jun 2024 23:52:24 +1000 Subject: [PATCH] v0.15.9 URI.encode fix --- gossamer_forums.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gossamer_forums.rb b/gossamer_forums.rb index 5159cd3..9ee7ee2 100644 --- a/gossamer_forums.rb +++ b/gossamer_forums.rb @@ -1,5 +1,5 @@ # gossamer threads migration-import code -# v0.15.8 +# v0.15.9 require 'mysql2' require 'open-uri' @@ -398,7 +398,8 @@ class GossamerForumsImporter < ImportScripts::Base execute_query("SELECT * FROM gforum_User_Files WHERE ForeignColKey = #{original_gossamer_id}").each do |file| # encoded_filename = URI.encode(file['File_Name']) - encoded_filename = URI.encode_www_form_component(file['File_Name']) + double_encoded_filename = file['File_Name'].gsub('%', '%25') + encoded_filename = URI.encode_www_form_component(double_encoded_filename) 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}"