Index: openacs-4/packages/file-storage/www/download-zip.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/download-zip.tcl,v diff -u -r1.9.2.6 -r1.9.2.7 --- openacs-4/packages/file-storage/www/download-zip.tcl 18 Jun 2021 14:46:15 -0000 1.9.2.6 +++ openacs-4/packages/file-storage/www/download-zip.tcl 18 Jun 2021 14:52:33 -0000 1.9.2.7 @@ -44,26 +44,32 @@ set out_file [ad_tmpnam] -# create the archive ad_try { + + # create the archive util::zip -source $in_path -destination $out_file + +} on ok {d} { + + # return the archive to the connection. + ns_set put [ad_conn outputheaders] Content-Disposition "attachment;filename=\"$download_name\"" + ns_set put [ad_conn outputheaders] Content-Type "application/zip" + ns_set put [ad_conn outputheaders] Content-Size [ad_file size $out_file] + ns_returnfile 200 application/octet-stream $out_file + } on error {errorMsg} { + # some day we'll do something useful here - file delete -force -- $in_path - file delete -- $out_file error $errorMsg -} -# return the archive to the connection. -ns_set put [ad_conn outputheaders] Content-Disposition "attachment;filename=\"$download_name\"" -ns_set put [ad_conn outputheaders] Content-Type "application/zip" -ns_set put [ad_conn outputheaders] Content-Size "[ad_file size $out_file]" -ns_returnfile 200 application/octet-stream $out_file +} finally { -# clean everything up -file delete -force -- $in_path -file delete -- $out_file + # clean everything up + file delete -force -- $in_path + file delete -- $out_file +} + # Local variables: # mode: tcl # tcl-indent-level: 4