Skip to content

Commit

Permalink
Item12952: Recover ScripSuffix from the FindBin script
Browse files Browse the repository at this point in the history
With short URLs,  the script is not entered on view,  so recover the
suffix from the FindBin results.
  • Loading branch information
gac410 committed Sep 3, 2014
1 parent 0a63701 commit d50c7e1
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions core/lib/Foswiki.pm
Expand Up @@ -384,6 +384,11 @@ BEGIN {
"AUTOCONFIG: Found Bin dir: $bin, Script name: $script using FindBin\n"
if (TRAUTO);

$Foswiki::cfg{ScriptSuffix} = ( $script =~ /(\.[^.]*)$/ ) ? $1 : '';
print STDERR
"AUTOCONFIG: Found SCRIPT SUFFIX $Foswiki::cfg{ScriptSuffix} \n"
if ( TRAUTO && $Foswiki::cfg{ScriptSuffix} );

my $protocol = $ENV{HTTPS} ? 'https' : 'http';
if ( $ENV{HTTP_HOST} ) {
$Foswiki::cfg{DefaultUrlHost} = "$protocol://$ENV{HTTP_HOST}";
Expand Down Expand Up @@ -414,12 +419,6 @@ BEGIN {
print STDERR "AUTOCONFIG: Found SCRIPT $ENV{SCRIPT_NAME} \n"
if (TRAUTO);

$Foswiki::cfg{ScriptSuffix} =
( $ENV{SCRIPT_NAME} =~ /(\.[^.]*)$/ ) ? $1 : '';
print STDERR
"AUTOCONFIG: Found SCRIPT SUFFIX $Foswiki::cfg{ScriptSuffix} \n"
if ( TRAUTO && $Foswiki::cfg{ScriptSuffix} );

if ( $ENV{SCRIPT_NAME} =~ m{^(.*?)/$script(\b|$)} ) {

# Conventional URLs with path and script
Expand Down Expand Up @@ -449,7 +448,6 @@ BEGIN {
$Foswiki::cfg{ScriptUrlPaths}{view} = '';
$Foswiki::cfg{ScriptUrlPath} = '/bin';
$Foswiki::cfg{PubUrlPath} = '/pub';
$Foswiki::cfg{ScriptSuffix} = '';
}

print STDERR
Expand Down

0 comments on commit d50c7e1

Please sign in to comment.