Index: openacs-4/packages/acs-api-browser/www/content-page-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/content-page-view.tcl,v diff -u -N -r1.5.4.8 -r1.5.4.9 --- openacs-4/packages/acs-api-browser/www/content-page-view.tcl 11 Sep 2014 08:01:05 -0000 1.5.4.8 +++ openacs-4/packages/acs-api-browser/www/content-page-view.tcl 14 Sep 2014 09:02:41 -0000 1.5.4.9 @@ -48,30 +48,32 @@ } } - - lappend context [file tail $path] +set path [apidoc::sanitize_path $path] -set filename "$::acs::rootdir/$path" - -if {[regsub -all {[.][.]/} $filename "" shortened_filename]} { - ns_log notice "INTRUDER ALERT:\n\nsomesone tried to snarf '$filename'!\n file exists: [file exists $filename]\n user_id: [ad_conn user_id]\n peer: [ad_conn peeraddr]\n" - set filename shortened_filename +if {![file readable $::acs::rootdir/$path] || [file isdirectory $::acs::rootdir/$path]} { + if {[info exists version_id]} { + set kind content + set href [ad_conn package_url]/package-view?[export_vars {version_id {kind procs}}] + set link [subst {

Go back to Package Documentation.}] + } else { + set link [subst {

Go back to API Browser.}] + } + ad_return_warning "No such content page" [subst { + The file '$path' was not found. Maybe the url contains a typo. + $link + }] + return } -if {![file exists $filename] || [file isdirectory $filename]} { - set file_contents "file '$filename' not found" - multirow create xql_links link -} else { - if { $source_p } { - set file_contents [template::util::read_file $filename] - set file_contents [apidoc::tclcode_to_html $file_contents] - } - - template::util::list_to_multirow xql_links [::apidoc::xql_links_list $path] +if { $source_p } { + set file_contents [template::util::read_file $$::acs::rootdir/$path] + set file_contents [apidoc::tclcode_to_html $file_contents] } +template::util::list_to_multirow xql_links [::apidoc::xql_links_list $path] + set title [file tail $path] set script_documentation [api_script_documentation $path]