Add missing file extension to export URL
This commit is contained in:
parent
428db25c71
commit
48bd2f5bc7
|
@ -11,7 +11,7 @@ class Exporter
|
||||||
@user = user
|
@user = user
|
||||||
@obj = {}
|
@obj = {}
|
||||||
@export_dirname = Dir.mktmpdir("rs-export-")
|
@export_dirname = Dir.mktmpdir("rs-export-")
|
||||||
@export_filename = "#{File.basename(@export_dirname)}.tar.gz"
|
@export_filename = "#{File.basename(@export_dirname)}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def export
|
def export
|
||||||
|
@ -133,8 +133,8 @@ class Exporter
|
||||||
end
|
end
|
||||||
|
|
||||||
def publish
|
def publish
|
||||||
`tar czvf #{Rails.root.join "public", "export", @export_filename} -C /tmp/rs_export #{@export_dirname}`
|
`tar czvf #{Rails.root.join "public", "export", "#{@export_filename}.tar.gz"} -C /tmp/rs_export #{@export_dirname}`
|
||||||
url = "#{APP_CONFIG['https'] ? 'https' : 'http'}://#{APP_CONFIG['hostname']}/export/#{@export_filename}"
|
url = "#{APP_CONFIG['https'] ? 'https' : 'http'}://#{APP_CONFIG['hostname']}/export/#{@export_filename}.tar.gz"
|
||||||
@user.export_processing = false
|
@user.export_processing = false
|
||||||
@user.export_url = url
|
@user.export_url = url
|
||||||
@user.export_created_at = Time.now.utc
|
@user.export_created_at = Time.now.utc
|
||||||
|
|
|
@ -313,8 +313,8 @@ RSpec.describe Exporter do
|
||||||
it "publishes an archive" do
|
it "publishes an archive" do
|
||||||
Timecop.freeze do
|
Timecop.freeze do
|
||||||
expect { subject }.to change { user.export_processing }.from(true).to(false)
|
expect { subject }.to change { user.export_processing }.from(true).to(false)
|
||||||
expect(File.exist?("#{fake_rails_root}/public/export/#{name}")).to eq(true)
|
expect(File.exist?("#{fake_rails_root}/public/export/#{name}.tar.gz")).to eq(true)
|
||||||
expect(user.export_url).to eq("https://example.com/export/#{name}")
|
expect(user.export_url).to eq("https://example.com/export/#{name}.tar.gz")
|
||||||
expect(user.export_created_at).to eq(Time.now.utc)
|
expect(user.export_created_at).to eq(Time.now.utc)
|
||||||
expect(user).to be_persisted
|
expect(user).to be_persisted
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue