Index: openacs-4/packages/file-storage/www/view/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/view/index.vuh,v diff -u -r1.10.2.3 -r1.10.2.4 --- openacs-4/packages/file-storage/www/view/index.vuh 5 Oct 2021 10:09:33 -0000 1.10.2.3 +++ openacs-4/packages/file-storage/www/view/index.vuh 6 Dec 2021 08:37:29 -0000 1.10.2.4 @@ -1,9 +1,7 @@ -# -*- tcl -*- -################## KLUDGE BY STAS ############### -# Try and look up the item in the content repository -################################################# ad_page_contract { - + + Try and look up the item in the content repository + @author Unknown @creation-date Unknown @cvs-id $Id$ @@ -26,15 +24,21 @@ set user_id [ad_conn user_id] -# Serve the page - -# DRB: Note that content::init modifies the local variable the_root, which is treated -# as though it's been passed by reference. This requires that the redirect treat the -# path as an absolute path within the filesystem. - -if {[parameter::get -parameter BehaveLikeFilesystemP -default 0] || [catch {set init_p [content::init the_url the_root $content_root $template_root public $revision_id $content_type]}] || !$init_p } { - - # Make sure we are not dealing with an upgraded file and there exists a file with the title +# +# DRB: Note that content::init modifies the local variable the_root, +# which is treated as though it's been passed by reference. This +# requires that the redirect treat the path as an absolute path within +# the filesystem. +# +if {[parameter::get -parameter BehaveLikeFilesystemP -default 0] + || [catch { + set init_p [content::init the_url the_root $content_root $template_root \ + public $revision_id $content_type] }] + || !$init_p } { + # + # Make sure we are not dealing with an upgraded file and there + # exists a file with the title + # if {$file_id eq ""} { set splitted_url [split $the_url "/"] set item_url_title [lindex $splitted_url end] @@ -44,16 +48,16 @@ set item_url_parent_folder [lindex $splitted_url end-2] set file_id [db_string upgraded_item_id { select min(i.item_id) - from cr_revisions r, cr_items i - where r.item_id = i.item_id - and r.title = :item_url_title - and i.parent_id in (select item_id - from cr_items - where name = :item_url_folder - and parent_id in (select item_id - from cr_items - where name = :item_url_parent_folder)) - order by revision_id desc + from cr_revisions r, cr_items i + where r.item_id = i.item_id + and r.title = :item_url_title + and i.parent_id in (select item_id + from cr_items + where name = :item_url_folder + and parent_id in (select item_id + from cr_items + where name = :item_url_parent_folder)) + order by revision_id desc } -default 0] } @@ -66,9 +70,7 @@ set file_id [content::symlink::resolve -item_id $file_id] } - if {(![info exists version_id] || $version_id eq "")} { - set version_id [content::item::get_live_revision -item_id $file_id] - } + set version_id [content::item::get_live_revision -item_id $file_id] if {[apm_package_installed_p views]} { views::record_view -object_id $file_id -viewer_id $user_id