# -*- tcl -*- # # Redirect to download files by URL # enables WebDAV as well as just making it easier to download stuff # @author Dave Bauer (dave@thedesignexperience.org) # @creation-date 2003-10-19 # @cvs-id $Id: index.vuh,v 1.6.2.2 2022/10/13 10:19:34 antoniop Exp $ set full_uri [ad_conn url] set extra_uri [ad_conn path_info] set root_folder [fs_get_root_folder] set file_item_id [fs::get_item_id -name $extra_uri -folder_id $root_folder] ns_log debug "File Storage index.vuh item_id=$file_item_id URL=[ad_conn url]" if {$file_item_id eq ""} { ns_log debug "File Storage return not found" ns_return 404 text/plain "File Not Found" ad_script_abort } set user_id [ad_conn user_id] permission::require_permission \ -object_id $file_item_id \ -privilege read \ -party_id $user_id set file_live_revision [content::item::get_live_revision -item_id $file_item_id] if {$file_live_revision eq ""} { # A cr_item might not have any revision that is live. We do not # deliver the file in this case. ns_returnnotfound ad_script_abort } if {[namespace which ::views::record_view] ne ""} { views::record_view -object_id $file_item_id -viewer_id $user_id } cr_write_content -revision_id $file_live_revision # Local variables: # mode: tcl # tcl-indent-level: 4 # indent-tabs-mode: nil # End: