fringd / zipline

A gem that lets you stream a zip file from rails
MIT License
289 stars 68 forks source link

Zip created cannot extract on Windows #65

Closed ChathuraHettiarachchi closed 2 years ago

ChathuraHettiarachchi commented 3 years ago
page_action :download, method: [:get] do
    sub_camps = SubCampaign.where(campaign_id: params[:campaign_id])
    responses = Response.where('sub_campaign_id IN (?)',sub_camps.ids)
    files = responses.map{|resp| if resp.response_video.url.present?
                                   [resp.response_video.url, "#{resp.sub_campaign.title.gsub(/[^0-9A-Za-z _]/, '')}/video/#{resp.response_video_identifier}"]
                                 elsif resp.response_audio.url.present?
                                   [resp.response_audio.url, "#{resp.sub_campaign.title.gsub(/[^0-9A-Za-z _]/, '')}/audio/#{resp.response_audio_identifier}"]
                                 end }
    zipline(files, "Camp_#{sub_camps.first.campaign.title.gsub(/[^0-9A-Za-z _]/, '')}_all_responses.zip")
  end

I'm using zipline to create a zip file on activeadmin. File created from zipline can extract using a mac or any unix env. But cannot extract on my Windows machine.

ChathuraHettiarachchi commented 3 years ago

Found that the file is not downloading completely on Windows. If I download the file from a Mac and extract it via Windows, it works. Original file was 440 mb and in Windows download completed at 268 mb

aried3r commented 3 years ago

The overwhelming majority of our customers use Windows and have not reported any issues so far. Is there a way you can create a reproducible testcase?

It's a bit outdated, but in https://github.com/fringd/zipline/issues/42#issuecomment-464726313 I described and linked a Rails 6 app that downloads and streams files when opened in the browser. Maybe that's something you can use.