changed: the list of extensions for the export system to pass through

unmodified has been moved to the configuration file under the
"exportBianryExtensions" field.
This commit is contained in:
Chris Nehren 2008-10-01 19:22:34 +00:00
parent 655e795f4a
commit 21058ead4d
4 changed files with 58 additions and 16 deletions

View file

@ -1,4 +1,7 @@
7.6.1
- changed: the list of extensions for the export system to pass through
unmodified has been moved to the configuration file under the
"exportBianryExtensions" field.
7.6.0
- added: users may now customize the post received page for the CS

View file

@ -27,20 +27,25 @@ my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
addExportExtensionsToConfigFile($session);
finish($session); # this line required
#----------------------------------------------------------------------------
# Describe what our function does
#sub exampleFunction {
# my $session = shift;
# print "\tWe're doing some stuff here that you should know about... " unless $quiet;
# # and here's our code
# print "DONE!\n" unless $quiet;
#}
# make sure each config file has the extensions to export as-is. however, if
# this system received a backport, leave the field as is.
sub addExportExtensionsToConfigFile {
my $session = shift;
# skip if the field has been defined already by backporting
return if defined $session->config->get('exportBinaryExtensions');
# otherwise, set the field
$session->config->set('exportBinaryExtensions',
[ qw/.html .htm .txt .pdf .jpg .css .gif .png .doc .xls .xml .rss .bmp
.mp3 .js .fla .flv .swf .pl .php .php3 .php4 .php5 .ppt .docx .zip .tar
.rar .gz .bz2/ ] );
}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------

View file

@ -830,7 +830,43 @@
"WebGUI::Content::Shop",
"WebGUI::Content::Asset",
"WebGUI::Content::NotFound"
]
],
# extensions that the export system should pass through as-is instead of using
# index.html
"exportBinaryExtensions" : [
".html",
".htm",
".txt",
".pdf",
".jpg",
".css",
".gif",
".png",
".doc",
".xls",
".xml",
".rss",
".bmp",
".mp3",
".js",
".fla",
".flv",
".swf",
".pl",
".php",
".php3",
".php4",
".php5",
".ppt",
".docx",
".zip",
".tar",
".rar",
".gz",
".bz2"
]
}

View file

@ -528,10 +528,8 @@ sub exportGetUrlAsPath {
# if we're still here, it's valid. get it.
my $exportPath = $config->get('exportPath');
# specify a list of file types apache recognises to be passed through as-is
my @fileTypes = qw/.html .htm .txt .pdf .jpg .css .gif .png .doc .xls .xml
.rss .bmp .mp3 .js .fla .flv .swf .pl .php .php3 .php4 .php5 .ppt .docx
.zip .tar .rar .gz .bz2/;
# get a list of file types to pass through as-is
my $fileTypes = $config->get('exportBinaryExtensions');
# get the asset's URL as a URI::URL object for easy parsing of components
my $url = URI::URL->new($config->get("sitename")->[0] . $self->getUrl);
@ -550,7 +548,7 @@ sub exportGetUrlAsPath {
# check if the file type is recognised by apache. if it is, return it
# as-is. if not, slap on the directory separator, $index, and return
# it.
if( isIn($extension, @fileTypes) ) {
if( isIn($extension, @{ $fileTypes } ) ) {
return Path::Class::File->new($exportPath, @pathComponents, $filename);
}
else { # don't know what it is