From 68ad43e88536c1f6e14618a4f00960e274317bce Mon Sep 17 00:00:00 2001 From: stephanie rousset Date: Thu, 27 Jun 2024 14:42:16 +0200 Subject: [PATCH] fix: password for zip of personal data --- .../app/services/decidim/download_your_data_exporter.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/decidim-core/app/services/decidim/download_your_data_exporter.rb b/decidim-core/app/services/decidim/download_your_data_exporter.rb index a8633f50d7e8..e14007c5441e 100644 --- a/decidim-core/app/services/decidim/download_your_data_exporter.rb +++ b/decidim-core/app/services/decidim/download_your_data_exporter.rb @@ -32,7 +32,7 @@ def export dirname = File.dirname(@path) FileUtils.mkdir_p(dirname) unless File.directory?(dirname) File.open(@path, "wb") do |file| - SevenZipRuby::Writer.open(file, password: @password) do |szw| + SevenZipRuby::Writer.open(file) do |szw| szw.header_encryption = true szw.add_data(data, ZIP_FILE_NAME) end @@ -42,7 +42,8 @@ def export private def data - buffer = Zip::OutputStream.write_buffer do |out| + enc = Zip::TraditionalEncrypter.new(@password) + buffer = Zip::OutputStream.write_buffer(::StringIO.new(""), enc) do |out| user_data, attachments = data_for(@user, @export_format) add_user_data_to_zip_stream(out, user_data)