Index: openacs-4/packages/file-storage/www/download-archive/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/download-archive/index.vuh,v diff -u -r1.6 -r1.7 --- openacs-4/packages/file-storage/www/download-archive/index.vuh 27 Oct 2014 16:41:35 -0000 1.6 +++ openacs-4/packages/file-storage/www/download-archive/index.vuh 27 Apr 2015 15:28:20 -0000 1.7 @@ -1,3 +1,4 @@ +# -*- Tcl -*- # file-storage/www/download-archive/index.vuh ad_page_contract { @@ -10,7 +11,7 @@ {object_id:naturalnum,optional} } -if {([info exists object_id] && $object_id ne "")} { +if {[info exists object_id] && $object_id ne ""} { set download_name [fs::get_file_system_safe_object_name -object_id $object_id] set ext [fs::get_archive_extension] if {$ext ne ""} { @@ -22,8 +23,14 @@ } # convenient way to get the values out of a list -foreach {object_id download_name} [split [ad_conn path_info] /] {break} +lassign [split [ad_conn path_info] /] object_id download_name +# The assignment above might not set the object_id, so set it to a +# value in that case such it will fail in the object_p test below. +if {![info exists object_id]} { + set object_id "" +} + if {![fs::object_p -object_id $object_id]} { ad_return_complaint 1 "Object \#$object_id is not a file storage object." ad_script_abort @@ -35,14 +42,14 @@ } # publish the object to the file system -set in_path [ns_tmpnam] +set in_path [ad_tmpnam] file mkdir $in_path set file [fs::publish_object_to_file_system -object_id $object_id -path $in_path -user_id $user_id] set file_name [file tail $file] # create a temp dir to put the archive in -set out_path [ns_tmpnam] +set out_path [ad_tmpnam] file mkdir $out_path set out_file [file join ${out_path} ${download_name}]