Forum OpenACS Q&A: Re: file-storage can't download old version

Collapse
Posted by Nitish Bezzala on
The current template does not get the revision_id from the query string. The template below does that.

file-storage-default.tcl

# Put the current revision's attributes in a onerow datasource named "content".
# The detected content type is "content_revision".

set revision_id [ lindex [ split [ ad_conn query ] = ] 1]

content::get_content content_revision

if { ![string equal -length 4 "text" $content(mime_type)] } {
# It's a file.
if { [string equal $revision_id ""]} {
cr_write_content -revision_id $content(revision_id)
} else {
cr_write_content -revision_id $revision_id
}

ad_script_abort
}

# Ordinary text/* mime type.
template::util::array_to_vars content

set text [cr_write_content -string -revision_id $revision_id]
if { ![string equal "text/html" $content(mime_type)] } {
set text [ad_html_text_convert -from $mime_type -to text/html $text]
}

set context [list $title]

ad_return_template

Collapse
Posted by Malte Sussdorff on
Nitish, which version of File Storage are you using, as I could not detect this behaviour in the latest code and not four versions before.
Collapse
Posted by Dave Bauer on
Please look at file-storage/www/view which sets the revision_id when the content is set with content::init