Skip to content

Commit 09dac7f

Browse files
committedFeb 18, 2012
Add some path munging based on what Plack::App::URLMap does for mounting the demo sites.
1 parent 0337d6a commit 09dac7f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed
 

‎wre/lib/WRE/WebguiDemo.pm

+12-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,18 @@ sub call {
3838
local $ENV{WEBGUI_CONFIG} = $webgui_config;
3939
my $psgi = WebGUI::Paths->defaultPSGI;
4040
my $app = Plack::Util::load_psgi($psgi);
41-
return Plack::Util::run_app($app, $env);
41+
42+
my $orig_path_info = my $path = $env->{PATH_INFO};
43+
my $orig_script_name = $env->{SCRIPT_NAME};
44+
45+
$path =~ s/\Q$id\E//;
46+
47+
$env->{PATH_INFO} = $path;
48+
$env->{SCRIPT_NAME} .= $id;
49+
return $self->response_cb($app->($env), sub {
50+
$env->{PATH_INFO} = $orig_path_info;
51+
$env->{SCRIPT_NAME} = $orig_script_name;
52+
});
4253
}
4354
# Extras can be served from nginx
4455
elsif ($r->uri->path eq "/create") {

0 commit comments

Comments
 (0)
Please sign in to comment.