kipr / harrogate

The IDE for the Wombat
GNU General Public License v3.0
5 stars 10 forks source link

[RFR] Javascript download headers #41

Closed jsoutherland closed 8 years ago

jsoutherland commented 8 years ago

Supersedes #40 which had the wrong base branch.

This PR fixes the internal server errors that occur when downloading projects as .tar .tar.gz and .zip formats.

Known issue: multifile zip archives are failing with the message:

events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: already processing an entry
    at ArchiveOutputStream.entry (/harrogate/node_modules/compress-commons/lib/archivers/archive-output-stream.js:75:14)
    at ZipStream.entry (/harrogate/node_modules/zip-stream/lib/zip-stream.js:105:49)
    at /harrogate/apps/programs/project.js:86:20
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:404:3)

...which seems very similar to the bug fixed by https://github.com/kipr/harrogate/pull/39

jsoutherland commented 8 years ago

I have learned that zip-stream can't handle asynchronous calls. We should switch to archiver (https://www.npmjs.com/package/archiver).

For now, I will consider this an improvement, since it allows multi-file project downloads via .tar and .tar.gz as well as single file downloads via .zip.