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.8 -r1.8.2.1 --- openacs-4/packages/attachments/www/go-to-attachment.tcl 23 Aug 2006 13:12:58 -0000 1.8 +++ openacs-4/packages/attachments/www/go-to-attachment.tcl 31 Mar 2007 07:10:12 -0000 1.8.2.1 @@ -32,6 +32,15 @@ } else { set filename $name } + + # 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 $filename] + if {$extension ne $file_extension} { + append filename ".${file_extension}" + } + ad_returnredirect "download/[ad_urlencode $filename]?object_id=$object_id&attachment_id=$attachment_id" ad_script_abort return Index: openacs-4/packages/attachments/www/go-to-attachment.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/www/go-to-attachment.xql,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/attachments/www/go-to-attachment.xql 23 Aug 2006 12:46:57 -0000 1.5 +++ openacs-4/packages/attachments/www/go-to-attachment.xql 31 Mar 2007 07:10:12 -0000 1.5.2.1 @@ -12,11 +12,12 @@ - select r.title,i.name, o.package_id - from cr_revisions r, cr_items i, acs_objects o + select r.title,i.name, o.package_id, m.file_extension + from cr_revisions r, cr_items i, acs_objects o, cr_mime_types m where i.item_id = :attachment_id and r.revision_id = i.live_revision and i.item_id = o.object_id + and m.mime_type = r.mime_type