Skip to content

A platform for community discussion. Free, open, simple.

Add attachment folder name in prefix for lithium import

Vinoth Kannanef4a86456ba5
diff --git a/script/import_scripts/lithium.rb b/script/import_scripts/lithium.rb
index ebfb3eda00e..8d84053b9b4 100644
--- a/script/import_scripts/lithium.rb
+++ b/script/import_scripts/lithium.rb
@@ -822,7 +822,8 @@ SQL
end
def find_upload(user_id, attachment_id, real_filename)
- filename = File.join(ATTACHMENT_DIR, "#{attachment_id.to_s.rjust(4, "0")}.dat")
+ filename = attachment_id.to_s.rjust(4, "0")
+ filename = File.join(ATTACHMENT_DIR, "000#{filename[0]}/#{filename}.dat")
unless File.exists?(filename)
puts "Attachment file doesn't exist: #{filename}"
@@ -976,7 +977,7 @@ SQL
user = UserCustomField.find_by(name: 'import_id', value: uid).try(:user)
if user.present?
username = user.username
- span = doc.create_element "span"
+ span = l.document.create_element "span"
span.inner_html = "@#{username}"
l.replace span
end