Index: openacs-4/packages/attachments/www/go-to-attachment.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/www/go-to-attachment.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/attachments/www/go-to-attachment.tcl 17 May 2003 10:13:01 -0000 1.5 +++ openacs-4/packages/attachments/www/go-to-attachment.tcl 28 Aug 2003 09:41:46 -0000 1.6 @@ -12,27 +12,28 @@ permission::require_permission -object_id $object_id -privilege read # Get information about attachment -if {![db_0or1row select_attachment_data {}]} { - ad_return_complaint "[_ attachments.lt_No_such_attachment_fo]" +set content_type [item::get_type $attachment_id] +if { [string length $content_type] == 0 } { + ad_return_complaint 1 [_ attachments.lt_No_such_attachment_fo] return } -switch $object_type { +switch $content_type { content_extlink { ad_returnredirect [db_string select_url {}] ad_script_abort return } - content_item { + file_storage_object { set title [db_string select_attachment_title {}] ad_returnredirect "download/[ad_urlencode $title]?object_id=$object_id&attachment_id=$attachment_id" ad_script_abort return } default { - ad_return_complaint "[_ attachments.lt_dont_know_how_to_deal]" + ad_return_complaint 1 [_ attachments.lt_dont_know_how_to_deal [list content_type $content_type]] return } }