Skip to content

Commit

Permalink
Item13969: revert reverting parsing path_info.
Browse files Browse the repository at this point in the history
This IS the right solution for rest even if  not right for jsonrpc.
Why throw out the rest fix because jsonrpc is broken.
  • Loading branch information
gac410 committed Mar 9, 2016
1 parent f77ae87 commit db7f094
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions core/lib/Foswiki.pm
Expand Up @@ -2202,13 +2202,25 @@ sub new {
# does not provide a web.
# path_info Defaults to the Users web Home topic

# Note that the jsonrpc script does none of these. A default
# web/topic is part of the posted json request.

# Set the default for web
# Development.AddWebParamToAllCgiScripts: enables
# bin/script?topic=WebPreferences;defaultweb=Sandbox
my $defaultweb = $query->param('defaultweb') || $Foswiki::cfg{UsersWebName};

# Scripts like rest, jsonrpc, don't use web/topic path.
my $webtopic = urlDecode( $query->path_info() || '' );
# rest doesn't use web/topic path, but pick up a default.
my $webtopic = '';

# SMELL: It is completely bogus that we do this for the jsonrpc script.
# But we must, because jsonrpc depends upon the bogus path_info to trigger
# a bug in core which results in an unassigned default BASEWEB and BASETOPIC.
# If jsonrpc gets a default web/topic, it will pick up settings for the
# wrong topic and fail.
unless ( $query->action() eq 'rest' ) {
$webtopic = urlDecode( $query->path_info() || '' );
}

my $topicOverride = '';
my $topic = $query->param('topic');
Expand Down

0 comments on commit db7f094

Please sign in to comment.