app/serializers/decidim/assemblies/assembly_importer.rb in decidim-assemblies-0.26.10 vs app/serializers/decidim/assemblies/assembly_importer.rb in decidim-assemblies-0.27.0.rc1
- old
+ new
@@ -59,13 +59,12 @@
github_handler: attributes["github_handler"],
created_by: attributes["created_by"],
meta_scope: attributes["meta_scope"],
announcement: attributes["announcement"]
)
- @imported_assembly.attached_uploader(:hero_image).remote_url = attributes["remote_hero_image_url"] if attributes["remote_hero_image_url"].present?
- @imported_assembly.attached_uploader(:banner_image).remote_url = attributes["remote_banner_image_url"] if attributes["remote_banner_image_url"].present?
-
+ @imported_assembly.remote_hero_image_url = attributes["remote_hero_image_url"] if remote_file_exists?(attributes["remote_hero_image_url"])
+ @imported_assembly.remote_banner_image_url = attributes["remote_banner_image_url"] if remote_file_exists?(attributes["remote_banner_image_url"])
@imported_assembly.save!
@imported_assembly
end
end
@@ -106,10 +105,10 @@
return if attachments["files"].nil?
attachments["files"].map do |file|
next unless remote_file_exists?(file["remote_file_url"])
- file_tmp = URI.open(file["remote_file_url"])
+ file_tmp = URI.parse(file["remote_file_url"]).open
Decidim.traceability.perform_action!("create", Attachment, @user) do
attachment = Attachment.new(
title: file["title"],
description: file["description"],