Index: openacs-4/packages/static-pages/www/page-visit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-pages/www/page-visit.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/static-pages/www/page-visit.tcl 18 Sep 2002 12:03:33 -0000 1.4 +++ openacs-4/packages/static-pages/www/page-visit.tcl 16 Jan 2003 14:02:32 -0000 1.5 @@ -19,11 +19,27 @@ # characters will then be stripped off to produce the URL. # DaveB: not anymore! We chop off that part and just stuff the relative # path in the database to allow leaving the static-pages in the filesystem -# -#if { [string first "[acs_root_dir]/www" $filename] != 0 } { -# ad_return_error "Error in filename" "This page has an invalid filename." -#} -ad_returnredirect $filename +# There are two possiblities: Either the static page is beneath the +# site global www/ directory (and the filename starts "/www/"), or it +# is beneath one of the package www directories (and the filename +# starts "/packages/": +if { [string first "/www/" $filename] == 0 } { + set redirect_to "/[string range $filename [string length "/www/"] end]" +} elseif { [regexp "^/packages/(\[^/\]+)" $filename match package_dir] } { + # TODO: We are assuming that the package directory name $package_dir + # is in fact always the package key. Is this really true? + + if { ![regexp "^/packages/$package_dir/www/(.+)" $filename match url_part] } { + ad_return_error "Error in filename" "This page has an invalid filename: '$filename'." + } + set redirect_to "[sp_package_url $package_dir]$url_part" + +} else { + ad_return_error "Error in filename" "This page has an invalid filename: '$filename'." + return +} + +ad_returnredirect $redirect_to