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

Hi,

I have posted a bug no 2236.

Steps to Reproduce
1. Browse to file storage module.
2. Upload file1.
3. Upload a revision file2.
4. Click on the properties link
5. Click on file1 to download it.
Actual Results : Downloads file2.
Expected Results : should download file1.

When I delete a new version, and then download the older version, the correct version is downloaded. So the versions are uploaded and stored correctly, only the download is a problem.

Could someone please let me know where I should look for the problem or how to solve it.

Thanks,
Nitish

Collapse
Posted by Harish Krishnan on
Doesnt look like a bug to me ....
Collapse
Posted by Harish Krishnan on
oops ... sorry about that .. my mind went on a holiday 😉
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 Nitish Bezzala on
Malte,

I have downloade file-storage-5.1.0a13.apm and am using it, with OpenACS 5.1.1.

Nitish

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