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 -r1.6 -r1.6.8.1 --- openacs-4/packages/attachments/www/go-to-attachment.tcl 28 Aug 2003 09:41:46 -0000 1.6 +++ openacs-4/packages/attachments/www/go-to-attachment.tcl 31 Mar 2007 07:05:32 -0000 1.6.8.1 @@ -26,7 +26,15 @@ } file_storage_object { - set title [db_string select_attachment_title {}] + db_1row select_attachment {} + + # Test if the filename contains the extension, otherwise append it + # This usually happens if you just rename the title (displayed filename) but forget + # to append the extension to it. + set extension [file extension $title] + if {$extension ne $file_extension} { + append title ".${file_extension}" + } ad_returnredirect "download/[ad_urlencode $title]?object_id=$object_id&attachment_id=$attachment_id" ad_script_abort return